aboutsummaryrefslogtreecommitdiff
path: root/builtin-shortlog.c
diff options
context:
space:
mode:
authorPierre Habouzit <madcoder@debian.org>2007-09-16 00:32:36 +0200
committerJunio C Hamano <gitster@pobox.com>2007-09-18 17:42:17 -0700
commit182af8343c307436bb5364309aa6d4d46fa5911d (patch)
tree154c50047e12595027a0d61f54bfdd6ecd2305a5 /builtin-shortlog.c
parent39bd2eb56af89d43a08ba54699d9a1849ab57b39 (diff)
downloadgit-182af8343c307436bb5364309aa6d4d46fa5911d.tar.gz
git-182af8343c307436bb5364309aa6d4d46fa5911d.tar.xz
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-shortlog.c')
-rw-r--r--builtin-shortlog.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 16af6199a..3fe754677 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -39,10 +39,7 @@ static void insert_author_oneline(struct path_list *list,
while (authorlen > 0 && isspace(author[authorlen - 1]))
authorlen--;
- buffer = xmalloc(authorlen + 1);
- memcpy(buffer, author, authorlen);
- buffer[authorlen] = '\0';
-
+ buffer = xmemdupz(author, authorlen);
item = path_list_insert(buffer, list);
if (item->util == NULL)
item->util = xcalloc(1, sizeof(struct path_list));
@@ -66,13 +63,9 @@ static void insert_author_oneline(struct path_list *list,
oneline++;
onelinelen--;
}
-
while (onelinelen > 0 && isspace(oneline[onelinelen - 1]))
onelinelen--;
-
- buffer = xmalloc(onelinelen + 1);
- memcpy(buffer, oneline, onelinelen);
- buffer[onelinelen] = '\0';
+ buffer = xmemdupz(oneline, onelinelen);
if (dot3) {
int dot3len = strlen(dot3);