From b0b44bc7b26c8c4b4221a377ce6ba174b843cb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 18 Oct 2008 10:41:33 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- remote.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'remote.c') diff --git a/remote.c b/remote.c index 98cbcf94c..44d681da0 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; } -- cgit v1.2.1