* realloc
@ 2006-04-07 20:11 Morten Welinder
2006-04-07 20:35 ` realloc Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Morten Welinder @ 2006-04-07 20:11 UTC (permalink / raw)
To: GIT Mailing List
I could be wrong, but shouldn't
var = realloc (var, whatever);
be changed to call xrealloc? That, or assign to a different variable and check
for NULL.
This should affect the last four hits below.
M.
/scratch/welinder/git> grep -w realloc *.c
daemon.c: newlist = realloc(socklist, sizeof(int) *
(socknum + 1));
diff-delta.c: out = realloc(out, outsize);
git.c: cmdname = realloc(cmdname, cmdname_alloc * sizeof(*cmdname));
ls-files.c: which->excludes = realloc(which->excludes,
sha1_file.c: buf = realloc(buf, size);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: realloc
2006-04-07 20:11 realloc Morten Welinder
@ 2006-04-07 20:35 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2006-04-07 20:35 UTC (permalink / raw)
To: git
"Morten Welinder" <mwelinder@gmail.com> writes:
> I could be wrong, but shouldn't
>
> var = realloc (var, whatever);
>
> be changed to call xrealloc? That, or assign to a different variable and check
> for NULL.
>
> This should affect the last four hits below.
>
> M.
>
>
>
>
> /scratch/welinder/git> grep -w realloc *.c
> daemon.c: newlist = realloc(socklist, sizeof(int) *
> (socknum + 1));
> diff-delta.c: out = realloc(out, outsize);
> git.c: cmdname = realloc(cmdname, cmdname_alloc * sizeof(*cmdname));
> ls-files.c: which->excludes = realloc(which->excludes,
> sha1_file.c: buf = realloc(buf, size);
There is no excuse for not using xrealloc() in git.c,
ls-files.c, and sha1_file.c.
The diff-delta.c code wants to be independent from the rest of
git code, so it probably should check the returned value itself.
Historically to a certain degree daemon.c also wanted to be
independent from the rest of git, but I suspect it still is the
case (it uses small pieces from packet interface but that is
about it).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-07 20:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-07 20:11 realloc Morten Welinder
2006-04-07 20:35 ` realloc Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox