Skip to contentSkip to conversation

mailmap.c: Fix a sparse warning

PATCH New Ramsay Jones 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mailmap.c: Fix a sparse warning

In particular, sparse issues an "Using plain integer as NULL pointer" warning (line 214), since an integer zero is passed as the second actual argument in a strbuf_detach() call. The expected type for this parameter is 'size_t *'. In order to suppress the warning, we simply pass a NULL pointer constant instead.

---

Hi Antoine,

When you re-roll your mailmap patches (branch 'ap/log-mailmap') could you please squash this into commit a09b6cd9 ("mailmap: Remove buffer length limit in map_user", 11-12-2012).

Thanks!

ATB,
Ramsay Jones

 mailmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mailmap.c +1 -1
index e636278..0608eb3 100644
@@ -211,7 +211,7 @@ int map_user(struct string_list *map,
 	for (i = 0; i < end_of_email - email; i++)
 		strbuf_addch(&buf, tolower(email[i]));
 	strbuf_addch(&buf, 0);
-	mailbuf = strbuf_detach(&buf, 0);
+	mailbuf = strbuf_detach(&buf, NULL);
 
 	debug_mm("map_user: map '%s' <%s>\n", name, mailbuf);
 	item = string_list_lookup(map, mailbuf);
Signature · 1 line
1.8.0