From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fmt-merge-msg: show those involved in a merged series
Date: Thu, 08 Mar 2012 13:31:29 -0800 [thread overview]
Message-ID: <7vr4x2bwzy.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7v1up2ew9u.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 08 Mar 2012 11:18:53 -0800")
Junio C Hamano <gitster@pobox.com> writes:
>> Three of the five callers introduced in that commit cast the result to
>> int and the remaining two don't care, so it actually does seem to
>> matter for most of them, strictly speaking. When I see a nit, I can't
>> resist the urge to pick it, apparently.
>
> Unfortunately, replacing intptr_t with int or casting the above
> again as int will result in
>
> builtin/fmt-merge-msg.c: In function 'record_person':
> builtin/fmt-merge-msg.c:213: error: cast to pointer from integer of different size
>
> So...
-- >8 --
Subject: [PATCH] fmt-merge-msg.c: make util_as_int() return "int"
As its name says, the return value from util_as_int() should be
usable where an int is called for without casting.
Spotted-by: René Scharfe
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin/fmt-merge-msg.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 40b90b1..8ddefb3 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -182,7 +182,7 @@ static void add_branch_desc(struct strbuf *out, const char *name)
strbuf_release(&desc);
}
-#define util_as_int(elem) ((intptr_t)((elem)->util))
+#define util_as_int(elem) ((int)((elem)->util))
static void record_person(int which, struct string_list *people,
struct commit *commit)
@@ -210,7 +210,7 @@ static void record_person(int which, struct string_list *people,
elem = string_list_insert(people, name_buf);
elem->util = (void *)0;
}
- elem->util = (void*)(util_as_int(elem) + 1);
+ elem->util = (void*)((intptr_t)(util_as_int(elem) + 1));
}
static int cmp_string_list_util_as_int(const void *a_, const void *b_)
@@ -226,13 +226,13 @@ static void add_people_count(struct strbuf *out, struct string_list *people)
else if (people->nr == 2)
strbuf_addf(out, "%s (%d) and %s (%d)",
people->items[0].string,
- (int)util_as_int(&people->items[0]),
+ util_as_int(&people->items[0]),
people->items[1].string,
- (int)util_as_int(&people->items[1]));
+ util_as_int(&people->items[1]));
else if (people->nr)
strbuf_addf(out, "%s (%d) and others",
people->items[0].string,
- (int)util_as_int(&people->items[0]));
+ util_as_int(&people->items[0]));
}
static int committer_is_me(const char *name)
--
1.7.10.rc0.28.g709d0
next prev parent reply other threads:[~2012-03-08 21:31 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 3:17 A possible fmt-merge-msg update? Junio C Hamano
2012-03-05 5:24 ` Linus Torvalds
2012-03-05 19:04 ` Junio C Hamano
2012-03-05 20:33 ` Linus Torvalds
2012-03-05 21:34 ` [PATCH] fmt-merge-msg: show those involved in a merged series Junio C Hamano
2012-03-05 21:46 ` Linus Torvalds
2012-03-05 21:49 ` Junio C Hamano
2012-03-07 21:22 ` René Scharfe
2012-03-07 21:59 ` Junio C Hamano
2012-03-08 17:46 ` René Scharfe
2012-03-08 19:18 ` Junio C Hamano
2012-03-08 21:31 ` Junio C Hamano [this message]
2012-03-12 21:37 ` Phil Hord
2012-03-13 21:03 ` Jeff King
2012-03-14 3:44 ` Junio C Hamano
2012-03-14 19:12 ` Phil Hord
2012-03-12 7:11 ` Jonathan Nieder
2012-03-13 1:55 ` Junio C Hamano
2012-03-13 5:23 ` Jonathan Nieder
2012-03-13 5:45 ` Junio C Hamano
2012-03-13 7:27 ` Johannes Sixt
2012-03-13 18:26 ` Junio C Hamano
2012-03-14 6:37 ` Johannes Sixt
2012-03-14 20:34 ` Junio C Hamano
2012-03-13 18:28 ` [PATCH v2 1/1] " Junio C Hamano
2012-05-11 10:31 ` [PATCH/RFC] fmt-merge-msg: add a blank line after people info Jonathan Nieder
2012-05-11 22:46 ` Junio C Hamano
2012-05-11 23:20 ` Linus Torvalds
2012-05-14 18:31 ` Junio C Hamano
2012-05-15 20:24 ` Junio C Hamano
2012-05-16 2:02 ` Linus Torvalds
2012-05-16 17:28 ` Junio C Hamano
2012-06-06 20:27 ` Jonathan Nieder
2012-06-06 20:46 ` Jonathan Nieder
2012-06-06 21:11 ` Junio C Hamano
2012-03-06 7:59 ` A possible fmt-merge-msg update? Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vr4x2bwzy.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=rene.scharfe@lsrfire.ath.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).