git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] builtin/config.c: compilation fix

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 9, 2013, 04:41 UTC
Message-ID
<7vli4b79x3.fsf@alter.siamese.dyndns.org>

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 []".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/config.c              | 2 +-
 test-urlmatch-normalization.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index c046f54..ae199e9 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -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, '.');
diff --git a/test-urlmatch-normalization.c b/test-urlmatch-normalization.c
index 2603899..78c8b3a 100644
--- a/test-urlmatch-normalization.c
+++ b/test-urlmatch-normalization.c
@@ -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;
 
-- 
1.8.3.3-1049-g890a991
Next: Kyle J. McKay
Message 1 of 3 in “builtin/config.c: compilation fix”
  1. builtin/config.c: compilation fixJunio C Hamano, Aug 9, 2013
  2. Kyle J. McKayAug 9, 2013
  3. Junio C HamanoAug 9, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.