Skip to contentSkip to conversation

builtin/commit.c: fix type warnings from gcc and sparse

PATCH In review Ramsay Jones 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 builtin/commit.c: fix type warnings from gcc and sparse

On 32-bit platforms (only), gcc and sparse both issue warnings about the type of the pointer expression passed as the third argument to find_commit_header(). In order to suppress the warnings, we simply change the type of the 'len' variable to size_t.

---

Hi Jeff,

If you need to re-roll your 'jk/commit-author-parsing' series, could you please squash this into the equivalent of commit 95b5989 ("determine_author_info(): reuse parsing functions", 27-08-2014).

Thanks!

ATB,
Ramsay Jones

 builtin/commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/commit.c +1 -1
index a9bef73..7cb9981 100644
@@ -583,7 +583,7 @@ static void determine_author_info(struct strbuf *author_ident)
 
 	if (author_message) {
 		struct ident_split ident;
-		unsigned long len;
+		size_t len;
 		const char *a;
 
 		a = find_commit_header(author_message_buffer, "author", &len);
Signature · 1 line
2.1.0
#1 lore raw
Quoted 7 lines · Ramsay Jones

On 32-bit platforms (only), gcc and sparse both issue warnings about the type of the pointer expression passed as the third argument to find_commit_header(). In order to suppress the warnings, we simply change the type of the 'len' variable to size_t.

Thanks, this looks good to me. I think I just switched between size_t and "unsigned long" during the development and forgot to tweak this spot.

Quoted 3 lines

If you need to re-roll your 'jk/commit-author-parsing' series, could you please squash this into the equivalent of commit 95b5989 ("determine_author_info(): reuse parsing functions", 27-08-2014).

I don't think I have any other reason to re-roll at this point. I'm happy to have this on top, or it can be squashed into the second from the top (95b5989) if we want to keep the history cleaner.

I'm also happy to re-roll just for this, but my impression is that is not really any easier on Junio than just squashing a patch in.

-Peff

#2 lore raw
Quoted 18 lines · Jeff King
Quoted 7 lines · Ramsay Jones

On 32-bit platforms (only), gcc and sparse both issue warnings about the type of the pointer expression passed as the third argument to find_commit_header(). In order to suppress the warnings, we simply change the type of the 'len' variable to size_t.

Thanks, this looks good to me. I think I just switched between size_t and "unsigned long" during the development and forgot to tweak this spot.

Quoted 3 lines

If you need to re-roll your 'jk/commit-author-parsing' series, could you please squash this into the equivalent of commit 95b5989 ("determine_author_info(): reuse parsing functions", 27-08-2014).

Quoted 6 lines

I don't think I have any other reason to re-roll at this point. I'm happy to have this on top, or it can be squashed into the second from the top (95b5989) if we want to keep the history cleaner.

I'm also happy to re-roll just for this, but my impression is that is not really any easier on Junio than just squashing a patch in.

Thanks for being very considerate ;-) Have squashed it in with "rebase -i" while preparing for the mid-day pushout.