summaryrefslogtreecommitdiff
path: root/tree-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-26 20:34:56 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-12-27 01:23:59 (GMT)
commit7e4a2a848377241b8fb4f624d1151bbf2f8d5814 (patch)
tree5b7f555c6aebd9c32b97dc27f3a18723549415f3 /tree-diff.c
parent7d6fb370bc98e5d4723103dda0829b00c79da213 (diff)
downloadgit-7e4a2a848377241b8fb4f624d1151bbf2f8d5814.zip
git-7e4a2a848377241b8fb4f624d1151bbf2f8d5814.tar.gz
git-7e4a2a848377241b8fb4f624d1151bbf2f8d5814.tar.bz2
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 'tree-diff.c')
-rw-r--r--tree-diff.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tree-diff.c b/tree-diff.c
index 0ef06a9..382092b 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -263,6 +263,10 @@ void diff_tree_setup_paths(const char **p)
paths = p;
nr_paths = count_paths(paths);
+ if (nr_paths == 0) {
+ pathlens = NULL;
+ return;
+ }
pathlens = xmalloc(nr_paths * sizeof(int));
for (i=0; i<nr_paths; i++)
pathlens[i] = strlen(paths[i]);