From 2e3dfb216991974b60fdb1933eb3331e03383e61 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 26 Aug 2014 06:24:20 -0400 Subject: log-tree: use FLEX_ARRAY in name_decoration We are already using the flex-array technique; let's annotate it with our usual FLEX_ARRAY macro. Besides being more readable, this is slightly more efficient on compilers that understand flex-arrays. Note that we need to bump the allocation in add_name_decoration, which did not explicitly add one byte for the NUL terminator of the string we are putting into the flex-array (it did not need to before, because the struct itself was over-allocated by one byte). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- commit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commit.h') diff --git a/commit.h b/commit.h index f3d2f57a89..99b9e78209 100644 --- a/commit.h +++ b/commit.h @@ -30,7 +30,7 @@ extern const char *commit_type; struct name_decoration { struct name_decoration *next; int type; - char name[1]; + char name[FLEX_ARRAY]; }; enum decoration_type { -- cgit 1.2.3-korg