OSDN Git Service

Merge branch 'sh/use-hashcpy'
authorJunio C Hamano <gitster@pobox.com>
Tue, 18 Mar 2014 20:51:04 +0000 (13:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Mar 2014 20:51:05 +0000 (13:51 -0700)
* sh/use-hashcpy:
  Use hashcpy() when copying object names

1  2 
bundle.c
reflog-walk.c
refs.c

diff --cc 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
@@@ -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;
diff --cc refs.c
Simple merge