summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2008-10-18 10:41:33 +0200
committerJunio C Hamano <gitster@pobox.com>2008-10-18 06:53:47 -0700
commitb0b44bc7b26c8c4b4221a377ce6ba174b843cb8d (patch)
tree511f98f4017d7ce38a775dfecaa91abb7b8b532f /remote.c
parent8009768e89dfe389327654cf9d6868f680ef1f40 (diff)
downloadgit-b0b44bc7b26c8c4b4221a377ce6ba174b843cb8d.tar.gz
use alloc_ref_from_str() everywhere
Replace pairs of alloc_ref() and strcpy() with alloc_ref_from_str(), simplifying the code. In connect.c, also a pair of alloc_ref() and memcpy() is replaced -- the additional cost of a strlen() call should not have too much of an impact. Consistency and simplicity are more important. In remote.c, the code was allocating 11 bytes more than needed for the name part, but I couldn't see them being used for anything. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/remote.c b/remote.c
index 98cbcf94c3..44d681da08 100644
--- a/remote.c
+++ b/remote.c
@@ -878,8 +878,7 @@ static struct ref *try_explicit_object_name(const char *name)
struct ref *ref;
if (!*name) {
- ref = alloc_ref(20);
- strcpy(ref->name, "(delete)");
+ ref = alloc_ref_from_str("(delete)");
hashclr(ref->new_sha1);
return ref;
}