aboutsummaryrefslogtreecommitdiff
path: root/http-push.c
diff options
context:
space:
mode:
authorKrzysztof Kowalczyk <kkowalczyk@gmail.com>2008-05-10 16:26:58 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-11 09:04:37 -0700
commit737922aa648c43bc6a61170bee5bfd46ff953f32 (patch)
treeebcdb2c587f0a5b781f0613a711f5501d6b89860 /http-push.c
parent1f8115b113def8ee03701aa87b26c5e8b7c94434 (diff)
downloadgit-737922aa648c43bc6a61170bee5bfd46ff953f32.tar.gz
git-737922aa648c43bc6a61170bee5bfd46ff953f32.tar.xz
alloc_ref_from_str(): factor out a common pattern of alloc_ref from string
Also fix an underallocation in walker.c::interpret_target(). Signed-off-by: Krzysztof Kowalczyk <kkowalczyk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/http-push.c b/http-push.c
index 939a76460..42727c8a4 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1761,8 +1761,7 @@ static void one_remote_ref(char *refname)
struct ref *ref;
struct object *obj;
- ref = alloc_ref(strlen(refname) + 1);
- strcpy(ref->name, refname);
+ ref = alloc_ref_from_str(refname);
if (http_fetch_ref(remote->url, ref) != 0) {
fprintf(stderr,
@@ -1894,8 +1893,7 @@ static void add_remote_info_ref(struct remote_ls_ctx *ls)
char *ref_info;
struct ref *ref;
- ref = alloc_ref(strlen(ls->dentry_name) + 1);
- strcpy(ref->name, ls->dentry_name);
+ ref = alloc_ref_from_str(ls->dentry_name);
if (http_fetch_ref(remote->url, ref) != 0) {
fprintf(stderr,