Skip to content

Commit 0dd398f

Browse files
committed
Merge branch 'jc/memzero-array' into next
Further application of MEMZERO_ARRAY() macro to the rest of the code base. * jc/memzero-array: cocci: use MEMZERO_ARRAY() a bit more coccicheck: emit the contents of cocci patch
2 parents 4d2f775 + 8ea9492 commit 0dd398f

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3523,7 +3523,7 @@ else
35233523
COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = $(COCCICHECK_PATCHES_INTREE)
35243524
endif
35253525
coccicheck: $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES)
3526-
! grep -q ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null
3526+
! grep ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null
35273527

35283528
# See contrib/coccinelle/README
35293529
coccicheck-pending: coccicheck-test

diffcore-delta.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)
5656
st_mult(sizeof(struct spanhash), sz)));
5757
new_spanhash->alloc_log2 = orig->alloc_log2 + 1;
5858
new_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);
59-
memset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);
59+
MEMZERO_ARRAY(new_spanhash->data, sz);
6060
for (i = 0; i < osz; i++) {
6161
struct spanhash *o = &(orig->data[i]);
6262
int bucket;
@@ -135,7 +135,7 @@ static struct spanhash_top *hash_chars(struct repository *r,
135135
st_mult(sizeof(struct spanhash), (size_t)1 << i)));
136136
hash->alloc_log2 = i;
137137
hash->free = INITIAL_FREE(i);
138-
memset(hash->data, 0, sizeof(struct spanhash) * ((size_t)1 << i));
138+
MEMZERO_ARRAY(hash->data, ((size_t)1 << i));
139139

140140
n = 0;
141141
accum1 = accum2 = 0;

linear-assignment.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ void compute_assignment(int column_count, int row_count, int *cost,
2020
int i, j, phase;
2121

2222
if (column_count < 2) {
23-
memset(column2row, 0, sizeof(int) * column_count);
24-
memset(row2column, 0, sizeof(int) * row_count);
23+
MEMZERO_ARRAY(column2row, column_count);
24+
MEMZERO_ARRAY(row2column, row_count);
2525
return;
2626
}
2727

shallow.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
709709

710710
if (used) {
711711
int bitmap_size = DIV_ROUND_UP(pi.nr_bits, 32) * sizeof(uint32_t);
712-
memset(used, 0, sizeof(*used) * info->shallow->nr);
712+
MEMZERO_ARRAY(used, info->shallow->nr);
713713
for (i = 0; i < nr_shallow; i++) {
714714
const struct commit *c = lookup_commit(the_repository,
715715
&oid[shallow[i]]);
@@ -774,7 +774,7 @@ static void post_assign_shallow(struct shallow_info *info,
774774

775775
trace_printf_key(&trace_shallow, "shallow: post_assign_shallow\n");
776776
if (ref_status)
777-
memset(ref_status, 0, sizeof(*ref_status) * info->ref->nr);
777+
MEMZERO_ARRAY(ref_status, info->ref->nr);
778778

779779
/* Remove unreachable shallow commits from "theirs" */
780780
for (i = dst = 0; i < info->nr_theirs; i++) {

0 commit comments

Comments
 (0)