Skip to content

Commit 006f678

Browse files
committed
Merge branch 'sh/use-hashcpy'
* sh/use-hashcpy: Use hashcpy() when copying object names
2 parents da2e057 + 50546b1 commit 006f678

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

bundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void add_to_ref_list(const unsigned char *sha1, const char *name,
1515
struct ref_list *list)
1616
{
1717
ALLOC_GROW(list->list, list->nr + 1, list->alloc);
18-
memcpy(list->list[list->nr].sha1, sha1, 20);
18+
hashcpy(list->list[list->nr].sha1, sha1);
1919
list->list[list->nr].name = xstrdup(name);
2020
list->nr++;
2121
}

grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ void grep_source_init(struct grep_source *gs, enum grep_source_type type,
16501650
break;
16511651
case GREP_SOURCE_SHA1:
16521652
gs->identifier = xmalloc(20);
1653-
memcpy(gs->identifier, identifier, 20);
1653+
hashcpy(gs->identifier, identifier);
16541654
break;
16551655
case GREP_SOURCE_BUF:
16561656
gs->identifier = NULL;

pack-bitmap-write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ void bitmap_writer_finish(struct pack_idx_entry **index,
530530
header.version = htons(default_version);
531531
header.options = htons(flags | options);
532532
header.entry_count = htonl(writer.selected_nr);
533-
memcpy(header.checksum, writer.pack_checksum, 20);
533+
hashcpy(header.checksum, writer.pack_checksum);
534534

535535
sha1write(f, &header, sizeof(header));
536536
dump_bitmap(f, writer.commits);

reflog-walk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
2828

2929
ALLOC_GROW(array->items, array->nr + 1, array->alloc);
3030
item = array->items + array->nr;
31-
memcpy(item->osha1, osha1, 20);
32-
memcpy(item->nsha1, nsha1, 20);
31+
hashcpy(item->osha1, osha1);
32+
hashcpy(item->nsha1, nsha1);
3333
item->email = xstrdup(email);
3434
item->timestamp = timestamp;
3535
item->tz = tz;

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ static int resolve_gitlink_packed_ref(struct ref_cache *refs,
12221222
if (ref == NULL)
12231223
return -1;
12241224

1225-
memcpy(sha1, ref->u.value.sha1, 20);
1225+
hashcpy(sha1, ref->u.value.sha1);
12261226
return 0;
12271227
}
12281228

0 commit comments

Comments
 (0)