Re: Expose subprojects as special files to "git diff" machinery
- From
Sam Ravnborg <sam@ravnborg.org>
- Date
- Apr 15, 2007, 19:01 UTC
- Message-ID
- <20070415190119.GA21786@uranus.ravnborg.org>
- In-Reply-To
- <Pine.LNX.4.64.0704151100550.5473@woody.linux-foundation.org>
Show 7 quoted lines
>
> +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.
I wonder if there is a specific reason why you decided upon xmalloc here? I see no problem in using xmalloc but wonder if there is something I should start to do differently??
Sam