Re: [PATCH] builtin/blame.c::prepare_lines: fix allocation size of sb->lineno

2014-02-08 Thread David Kastrup
Jeff King writes: > However, is there a reason not to use: > > sizeof(*sb->lineno) > > rather than > > sizeof(int) > > to avoid type-mismatch errors entirely (this applies both to this patch, > and to any proposed rewrites using malloc). It deviates from the style of the original code by tri

Re: [PATCH] builtin/blame.c::prepare_lines: fix allocation size of sb->lineno

2014-02-08 Thread Jeff King
On Sat, Feb 08, 2014 at 10:49:40AM +0100, David Kastrup wrote: > But please note that since sb->lineno originally comes from a zeroed > memory area and is passed to xrealloc, this requires that after > > int *p; > memset(&p, 0, sizeof(p)); > > the equivalence > > ((void *)p == NULL) > > will h

Re: [PATCH] builtin/blame.c::prepare_lines: fix allocation size of sb->lineno

2014-02-08 Thread David Kastrup
David Kastrup writes: > If we are calling xrealloc on every single line, the least we can do > is get the right allocation size. > > Signed-off-by: David Kastrup > --- > This should be less contentious than the patch in > http://permalink.gmane.org/gmane.comp.version-control.git/241561>, > Messa

[PATCH] builtin/blame.c::prepare_lines: fix allocation size of sb->lineno

2014-02-08 Thread David Kastrup
If we are calling xrealloc on every single line, the least we can do is get the right allocation size. Signed-off-by: David Kastrup --- This should be less contentious than the patch in http://permalink.gmane.org/gmane.comp.version-control.git/241561>, Message-ID: <1391550392-17118-1-git-send-ema