From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: Re: realloc
Date: Fri, 07 Apr 2006 13:35:30 -0700 [thread overview]
Message-ID: <7vmzexi0od.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <118833cc0604071311v1da93f83n112cc2ea44552ca9@mail.gmail.com> (Morten Welinder's message of "Fri, 7 Apr 2006 16:11:21 -0400")
"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).
prev parent reply other threads:[~2006-04-07 20:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-07 20:11 realloc Morten Welinder
2006-04-07 20:35 ` Junio C Hamano [this message]
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=7vmzexi0od.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.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