builtin/config.c: compilation fix
authorJunio C Hamano <gitster@pobox.com>
Fri, 9 Aug 2013 04:41:44 +0000 (21:41 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Aug 2013 16:20:38 +0000 (09:20 -0700)
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>
builtin/config.c
test-urlmatch-normalization.c
index c046f54829b5ad361d81b2eceae5738c8f59ab21..ae199e9f75eb1d52057cdc63da30418723049f4a 100644 (file)
@@ -404,7 +404,7 @@ static int get_urlmatch(const char *var, const char *url)
        config.cb = &values;
 
        if (!url_normalize(url, &config.url))
-               die(config.url.err);
+               die("%s", config.url.err);
 
        config.section = dup_downcase(var);
        section_tail = strchr(config.section, '.');
index 2603899bfe026364c1edf2672ff1ed19538a7f50..090bf219a7d499ae246f80c0d478eb37fdef8f8f 100644 (file)
@@ -3,7 +3,7 @@
 
 int main(int argc, char **argv)
 {
-       const char *usage = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
+       const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
        char *url1, *url2;
        int opt_p = 0, opt_l = 0;
 
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
        }
 
        if (argc < 2 || argc > 3)
-               die(usage);
+               die("%s", usage);
 
        if (argc == 2) {
                struct url_info info;
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
        }
 
        if (opt_p || opt_l)
-               die(usage);
+               die("%s", usage);
 
        url1 = url_normalize(argv[1], NULL);
        url2 = url_normalize(argv[2], NULL);