builtin/config.c: compilation fix

Do not feed a random string as the first parameter to die(); use "%s" as the format string instead. Do the same for test-urlmatch-normalization.c while saving a single pointer variable by turning a "const char *" constant string into "const char []", which is sufficient to squelch compilation warning (the compiler can see usage[] given to die() is a constant and will never have conversion specifiers that cause trouble). But for a good measure, give them the same "%s" treatment as well. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 8, 2013 at 21:41 UTC 6667a6ac20747eb56eb2c03c39aceaf6aebbae3c
2 files changed +4 -4
builtin/config.c
+1 -1
@@ -404,7 +404,7 @@ static int get_urlmatch(const char *var, const char *url)
404 config.cb = &values;
405
406 if (!url_normalize(url, &config.url))
407 - die(config.url.err);
407 + die("%s", config.url.err);
408
409 config.section = dup_downcase(var);
410 section_tail = strchr(config.section, '.');
test-urlmatch-normalization.c
+3 -3
@@ -3,7 +3,7 @@
3
4 int main(int argc, char **argv)
5 {
6 - const char *usage = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
6 + const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
7 char *url1, *url2;
8 int opt_p = 0, opt_l = 0;
9
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
27 }
28
29 if (argc < 2 || argc > 3)
30 - die(usage);
30 + die("%s", usage);
31
32 if (argc == 2) {
33 struct url_info info;
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
42 }
43
44 if (opt_p || opt_l)
45 - die(usage);
45 + die("%s", usage);
46
47 url1 = url_normalize(argv[1], NULL);
48 url2 = url_normalize(argv[2], NULL);