git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Clemens Buchacher <drizzd@aon.at>,
	Finn Arne Gangstad <finnag@pvv.org>,
	Tim Olsen <tim@brooklynpenguin.com>,
	git@vger.kernel.org
Subject: Re: [PATCH v2] diff -c -p: do not die on submodules
Date: Wed, 29 Apr 2009 23:50:20 +0200	[thread overview]
Message-ID: <81b0412b0904291450w3d292ed5i3b2ab5164c0ae0f4@mail.gmail.com> (raw)
In-Reply-To: <7vy6tj8aur.fsf_-_@gitster.siamese.dyndns.org>

2009/4/29 Junio C Hamano <gitster@pobox.com>:
> +
> +       if (S_ISGITLINK(mode)) {
> +               blob = xmalloc(100);
> +               *size = snprintf(blob, 100,
> +                                "Subproject commit %s\n", sha1_to_hex(sha1));

snprintf returns a signed value. It also has a bad record of returning
negative values for obscure reasons (on obscure platforms, admittedly).

For this particular case,

  strcpy(blob, "Subproject commit ");
  strcat(blob, sha1_to_hex(sha1));
  strcat(blob, "\n");
  *size = strlen(blob); /* that's a constant */

could be considered.

  reply	other threads:[~2009-04-29 21:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 17:36 different git-merge behavior with regard to submodules in 1.6.2.4 vs. 1.6.2.1 Tim Olsen
2009-04-28 18:29 ` Junio C Hamano
2009-04-28 21:12   ` Finn Arne Gangstad
2009-04-29  8:42     ` Clemens Buchacher
2009-04-29 12:15       ` Finn Arne Gangstad
2009-04-29 18:53       ` [PATCH] Teach gitlinks to combine-diff Junio C Hamano
2009-04-29 20:26         ` [PATCH v2] diff -c -p: do not die on submodules Junio C Hamano
2009-04-29 21:50           ` Alex Riesen [this message]
2009-04-29 22:13             ` Johannes Schindelin
2009-04-29 22:19               ` Alex Riesen
2009-04-29 22:39                 ` Johannes Schindelin
2009-04-30  5:47                   ` Alex Riesen
2009-04-30  6:07                     ` Finn Arne Gangstad
2009-04-29 23:09             ` Junio C Hamano
2009-04-29 18:54       ` different git-merge behavior with regard to submodules in 1.6.2.4 vs. 1.6.2.1 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=81b0412b0904291450w3d292ed5i3b2ab5164c0ae0f4@mail.gmail.com \
    --to=raa.lkml@gmail.com \
    --cc=drizzd@aon.at \
    --cc=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tim@brooklynpenguin.com \
    /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).