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:
authorPierre Habouzit <madcoder@debian.org>2007-09-16 02:32:36 +0400
committerJunio C Hamano <gitster@pobox.com>2007-09-19 04:42:17 +0400
commit182af8343c307436bb5364309aa6d4d46fa5911d (patch)
tree154c50047e12595027a0d61f54bfdd6ecd2305a5 /builtin-add.c
parent39bd2eb56af89d43a08ba54699d9a1849ab57b39 (diff)
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-add.c')
-rw-r--r--builtin-add.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/builtin-add.c b/builtin-add.c
index 0d7d0ce420..f9a65803d8 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -71,12 +71,8 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec,
baselen = common_prefix(pathspec);
path = ".";
base = "";
- if (baselen) {
- char *common = xmalloc(baselen + 1);
- memcpy(common, *pathspec, baselen);
- common[baselen] = 0;
- path = base = common;
- }
+ if (baselen)
+ path = base = xmemdupz(*pathspec, baselen);
/* Read the directory and prune it */
read_directory(dir, path, base, baselen, pathspec);