From: Junio C Hamano <gitster@pobox.com>
To: Brian Gernhardt <brian@gernhardtsoftware.com>
Cc: Git List <git@vger.kernel.org>, Sam Hocevar <sam@zoy.org>
Subject: [PATCH] grep: cast printf %.*s "precision" argument explicitly to int
Date: Sun, 08 Mar 2009 18:24:31 -0700 [thread overview]
Message-ID: <7vljrfij3k.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vtz63ijoz.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Sun, 08 Mar 2009 18:11:40 -0700")
On some systems, regoff_t that is the type of rm_so/rm_eo members are
wider than int; %.*s precision specifier expects an int, so use an explicit
cast.
A breakage reported on Darwin by Brian Gernhardt should be fixed with
this patch.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Junio C Hamano <gitster@pobox.com> writes:
> Brian, would this patch help?
A resend with a commit log message.
grep.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grep.c b/grep.c
index cace1c8..be99b34 100644
--- a/grep.c
+++ b/grep.c
@@ -490,9 +490,9 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol,
*eol = '\0';
while (next_match(opt, bol, eol, ctx, &match, eflags)) {
printf("%.*s%s%.*s%s",
- match.rm_so, bol,
+ (int)match.rm_so, bol,
opt->color_match,
- match.rm_eo - match.rm_so, bol + match.rm_so,
+ (int)(match.rm_eo - match.rm_so), bol + match.rm_so,
GIT_COLOR_RESET);
bol += match.rm_eo;
rest -= match.rm_eo;
--
1.6.2.206.g5bda76
next prev parent reply other threads:[~2009-03-09 1:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-08 23:27 git-grep Bus Error Brian Gernhardt
2009-03-08 23:41 ` Sam Hocevar
2009-03-09 0:58 ` Brian Gernhardt
2009-03-09 1:11 ` Junio C Hamano
2009-03-09 1:18 ` Junio C Hamano
2009-03-09 1:19 ` Brian Gernhardt
2009-03-09 1:24 ` Junio C Hamano [this message]
2009-03-09 1:48 ` Brian Gernhardt
2009-03-09 0:29 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vljrfij3k.fsf_-_@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=brian@gernhardtsoftware.com \
--cc=git@vger.kernel.org \
--cc=sam@zoy.org \
/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.
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 NNTP newsgroup(s).