summaryrefslogtreecommitdiff
path: root/builtin-ls-files.c
diff options
context:
space:
mode:
authorPierre Habouzit <madcoder@debian.org>2007-09-15 22:32:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-19 00:42:17 (GMT)
commit182af8343c307436bb5364309aa6d4d46fa5911d (patch)
tree154c50047e12595027a0d61f54bfdd6ecd2305a5 /builtin-ls-files.c
parent39bd2eb56af89d43a08ba54699d9a1849ab57b39 (diff)
downloadgit-182af8343c307436bb5364309aa6d4d46fa5911d.zip
git-182af8343c307436bb5364309aa6d4d46fa5911d.tar.gz
git-182af8343c307436bb5364309aa6d4d46fa5911d.tar.bz2
Use xmemdupz() in many places.
Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-ls-files.c')
-rw-r--r--builtin-ls-files.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index 6c1db86..48dd3f7 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -299,7 +299,6 @@ static void prune_cache(const char *prefix)
static const char *verify_pathspec(const char *prefix)
{
const char **p, *n, *prev;
- char *real_prefix;
unsigned long max;
prev = NULL;
@@ -326,14 +325,8 @@ static const char *verify_pathspec(const char *prefix)
if (prefix_offset > max || memcmp(prev, prefix, prefix_offset))
die("git-ls-files: cannot generate relative filenames containing '..'");
- real_prefix = NULL;
prefix_len = max;
- if (max) {
- real_prefix = xmalloc(max + 1);
- memcpy(real_prefix, prev, max);
- real_prefix[max] = 0;
- }
- return real_prefix;
+ return max ? xmemdupz(prev, max) : NULL;
}
/*