Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-26 23:34:56 +0300
committerJunio C Hamano <junkio@cox.net>2005-12-27 04:23:59 +0300
commit7e4a2a848377241b8fb4f624d1151bbf2f8d5814 (patch)
tree5b7f555c6aebd9c32b97dc27f3a18723549415f3 /diffcore-pathspec.c
parent7d6fb370bc98e5d4723103dda0829b00c79da213 (diff)
avoid asking ?alloc() for zero bytes.
Avoid asking for zero bytes when that change simplifies overall logic. Later we would change the wrapper to ask for 1 byte on platforms that return NULL for zero byte request. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diffcore-pathspec.c')
-rw-r--r--diffcore-pathspec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/diffcore-pathspec.c b/diffcore-pathspec.c
index 68fe009132..139fe882f9 100644
--- a/diffcore-pathspec.c
+++ b/diffcore-pathspec.c
@@ -48,6 +48,9 @@ void diffcore_pathspec(const char **pathspec)
for (i = 0; pathspec[i]; i++)
;
speccnt = i;
+ if (!speccnt)
+ return;
+
spec = xmalloc(sizeof(*spec) * speccnt);
for (i = 0; pathspec[i]; i++) {
spec[i].spec = pathspec[i];