From: Junio C Hamano Date: Tue, 18 Mar 2014 20:51:04 +0000 (-0700) Subject: Merge branch 'sh/use-hashcpy' X-Git-Tag: v2.0.0-rc0~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=006f678780e816a2540628e5473b0eea199d0b61;p=thirdparty%2Fgit.git Merge branch 'sh/use-hashcpy' * sh/use-hashcpy: Use hashcpy() when copying object names --- 006f678780e816a2540628e5473b0eea199d0b61 diff --cc bundle.c index 1388a3e6fd,7809fbb169..a85e0e4532 --- a/bundle.c +++ b/bundle.c @@@ -14,8 -14,12 +14,8 @@@ static const char bundle_signature[] = static void add_to_ref_list(const unsigned char *sha1, const char *name, struct ref_list *list) { - if (list->nr + 1 >= list->alloc) { - list->alloc = alloc_nr(list->nr + 1); - list->list = xrealloc(list->list, - list->alloc * sizeof(list->list[0])); - } + ALLOC_GROW(list->list, list->nr + 1, list->alloc); - memcpy(list->list[list->nr].sha1, sha1, 20); + hashcpy(list->list[list->nr].sha1, sha1); list->list[list->nr].name = xstrdup(name); list->nr++; } diff --cc reflog-walk.c index 2899729a8c,d490f7d7d8..0dd5084fe5 --- a/reflog-walk.c +++ b/reflog-walk.c @@@ -26,10 -26,14 +26,10 @@@ static int read_one_reflog(unsigned cha struct complete_reflogs *array = cb_data; struct reflog_info *item; - if (array->nr >= array->alloc) { - array->alloc = alloc_nr(array->nr + 1); - array->items = xrealloc(array->items, array->alloc * - sizeof(struct reflog_info)); - } + ALLOC_GROW(array->items, array->nr + 1, array->alloc); item = array->items + array->nr; - memcpy(item->osha1, osha1, 20); - memcpy(item->nsha1, nsha1, 20); + hashcpy(item->osha1, osha1); + hashcpy(item->nsha1, nsha1); item->email = xstrdup(email); item->timestamp = timestamp; item->tz = tz;