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

[PATCH] fast-import.c: Silence build warning

From
Michael Wookey <michaelwookey@gmail.com>
Date
Aug 31, 2009, 11:21 UTC
Message-ID
<d2e97e800908310421u7de8ae58o361bd64a026384bf@mail.gmail.com>

gcc 4.3.3 (Ubuntu 9.04) warns that the return value of strtoul() was not checked by issuing the following notice:

  warning: ignoring return value of ‘strtoul’, declared with attribute
warn_unused_result
Provide a dummy variable to keep the compiler happy.
Signed-off-by: Michael Wookey <michaelwookey@gmail.com>
---
 fast-import.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 7ef9865..1386e75 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1744,10 +1744,11 @@ static int validate_raw_date(const char *src,
char *result, int maxlen)
 {
 	const char *orig_src = src;
 	char *endp;
+	unsigned long int unused;

 	errno = 0;

-	strtoul(src, &endp, 10);
+	unused = strtoul(src, &endp, 10);
 	if (errno || endp == src || *endp != ' ')
 		return -1;

@@ -1755,7 +1756,7 @@ static int validate_raw_date(const char *src,
char *result, int maxlen)
 	if (*src != '-' && *src != '+')
 		return -1;

-	strtoul(src + 1, &endp, 10);
+	unused = strtoul(src + 1, &endp, 10);
 	if (errno || endp == src || *endp || (endp - orig_src) >= maxlen)
 		return -1;
-- 
1.6.4.2.236.gf324c
Next: Sverre Rabbelier
Message 1 of 9 in “fast-import.c: Silence build warning”
  1. fast-import.c: Silence build warningMichael Wookey, Aug 31, 2009
  2. Sverre RabbelierAug 31, 2009
  3. Alex RiesenAug 31, 2009
  4. Sverre RabbelierAug 31, 2009
  5. Michael WookeyAug 31, 2009
  6. Junio C HamanoAug 31, 2009
  7. Michael WookeyAug 31, 2009
  8. Stephen BoydSep 1, 2009
  9. Alex RiesenSep 1, 2009

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.