summary refs log tree commit diff
path: root/ll-merge.c
diff options
context:
space:
mode:
authorGary V. Vaughan <git@mlists.thewrittenword.com>2010-05-14 09:31:33 +0000
committerJunio C Hamano <gitster@pobox.com>2010-05-31 16:59:26 -0700
commit66dbfd55e38128db02eb340fcd89f54b734d4c6e (patch)
tree115937b86083814adcc97bc55424720e96da5f72 /ll-merge.c
parentebef82776512f56eec4b6ac98b076369eb5a93fa (diff)
Rewrite dynamic structure initializations to runtime assignment
Unfortunately, there are still plenty of production systems with
vendor compilers that choke unless all compound declarations can be
determined statically at compile time, for example hpux10.20 (I can
provide a comprehensive list of our supported platforms that exhibit
this problem if necessary).

This patch simply breaks apart any compound declarations with dynamic
initialisation expressions, and moves the initialisation until after
the last declaration in the same block, in all the places necessary to
have the offending compilers accept the code.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'll-merge.c')
-rw-r--r--ll-merge.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ll-merge.c b/ll-merge.c
index f9b3d854a9..3764a1ab72 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -139,17 +139,17 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
 {
 	char temp[4][50];
 	struct strbuf cmd = STRBUF_INIT;
-	struct strbuf_expand_dict_entry dict[] = {
-		{ "O", temp[0] },
-		{ "A", temp[1] },
-		{ "B", temp[2] },
-		{ "L", temp[3] },
-		{ NULL }
-	};
+	struct strbuf_expand_dict_entry dict[5];
 	const char *args[] = { NULL, NULL };
 	int status, fd, i;
 	struct stat st;
 
+	dict[0].placeholder = "O"; dict[0].value = temp[0];
+	dict[1].placeholder = "A"; dict[1].value = temp[1];
+	dict[2].placeholder = "B"; dict[2].value = temp[2];
+	dict[3].placeholder = "L"; dict[3].value = temp[3];
+	dict[4].placeholder = NULL; dict[4].value = NULL;
+
 	if (fn->cmdline == NULL)
 		die("custom merge driver %s lacks command line.", fn->name);