All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Junio C Hamano <junkio@cox.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Expose subprojects as special files to "git diff" machinery
Date: Sun, 15 Apr 2007 21:20:35 +0200	[thread overview]
Message-ID: <20070415192035.GA21934@uranus.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0704151204320.5473@woody.linux-foundation.org>

On Sun, Apr 15, 2007 at 12:05:44PM -0700, Linus Torvalds wrote:
> 
> 
> On Sun, 15 Apr 2007, Sam Ravnborg wrote:
> 
> > >  
> > > +static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
> > > +{
> > > +	int len;
> > > +	char *data = xmalloc(100);
> > > +	len = snprintf(data, 100,
> > > +		"Subproject commit %s\n", sha1_to_hex(s->sha1));
> > 
> > In userland I would use a local variable for an array of the size of 100.
> > I would normally only allocate when we are say 5x bigger.
> 
> We're _returning_ the pointer to the caller, so no, we cannot use an 
> automatic array.
Do not know how I missed that...
Thanks,
	Sam

  reply	other threads:[~2007-04-15 19:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-15 18:14 Expose subprojects as special files to "git diff" machinery Linus Torvalds
2007-04-15 19:01 ` Sam Ravnborg
2007-04-15 19:05   ` Linus Torvalds
2007-04-15 19:20     ` Sam Ravnborg [this message]
2007-04-15 20:16 ` Andy Parkins
2007-04-15 21:03   ` Linus Torvalds
2007-04-18  8:46     ` git-format-patch for binary files / merges [Re: Expose subprojects as special files to "git diff" machinery] Sam Vilain
2007-04-18 11:49       ` Alex Riesen
2007-04-18 11:52       ` Johannes Schindelin
2007-04-18 15:47       ` Linus Torvalds
2007-04-18 16:08         ` Junio C Hamano
2007-04-19  8:28         ` Johannes Schindelin

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=20070415192035.GA21934@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.