author | Brandon Casey <drafnel@gmail.com> | |
Sat, 8 Oct 2011 03:20:21 +0000 (22:20 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Oct 2011 17:05:22 +0000 (10:05 -0700) | ||
commit | 687296960d774a45df31df7bc371d01106a6f6b7 | |
tree | 75eb24bf9d3bf622cb72c8c23e4528a21178fc70 | tree | snapshot |
parent | 43d20a8c50355f7f68548e91bd8822c3cbfff52f | commit | diff |
refs.c: abort ref search if ref array is empty
The bsearch() implementation on IRIX 6.5 segfaults if it is passed NULL
for the base array argument even if number-of-elements is zero. So, let's
work around it by detecting an empty array and aborting early.
This is a useful optimization in its own right anyway, since we avoid a
useless allocation and initialization of the ref_entry when the ref array
is empty.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The bsearch() implementation on IRIX 6.5 segfaults if it is passed NULL
for the base array argument even if number-of-elements is zero. So, let's
work around it by detecting an empty array and aborting early.
This is a useful optimization in its own right anyway, since we avoid a
useless allocation and initialization of the ref_entry when the ref array
is empty.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c | diff | blob | history |