{"thread":{"id":"64619","subject":"[PATCH 0/2] Use MEMZERO_ARRAY() a bit more","startedAt":"2025-12-13T01:46:31Z","lastAt":"2025-12-15T05:14:28Z","messageCount":4,"participants":["Junio C Hamano","Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"532110","messageId":"20251213014628.3380826-1-gitster@pobox.com","threadId":"64619","inReplyTo":null,"subject":"[PATCH 0/2] Use MEMZERO_ARRAY() a bit more","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-12-13T01:46:26Z","receivedAt":"2025-12-13T01:46:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This builds on Toon's memzero-array work to make \"make coccicheck\"\npass at the tip of 'seen'\n\nJunio C Hamano (2):\n  coccicheck: emit the contents of cocci patch\n  cocci: use MEMZERO_ARRAY() a bit more\n\n Makefile            | 2 +-\n diffcore-delta.c    | 4 ++--\n linear-assignment.c | 4 ++--\n shallow.c           | 4 ++--\n 4 files changed, 7 insertions(+), 7 deletions(-)\n\n-- \n2.52.0-357-gead5eaf5b3\n\n"},{"id":"532111","messageId":"20251213014628.3380826-2-gitster@pobox.com","threadId":"64619","inReplyTo":"20251213014628.3380826-1-gitster@pobox.com","subject":"[PATCH 1/2] coccicheck: emit the contents of cocci patch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-12-13T01:46:27Z","receivedAt":"2025-12-13T01:46:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Telling the user \"you got some error messages\" without showing what\nthe errors are is almost useless in CI environment, as the errors\ncannot be examined without downloading build artifacts.\n\nArrange it to spew out the output when it fails.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Makefile | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Makefile b/Makefile\nindex 7ca2118813..0117d0008c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3521,7 +3521,7 @@ else\n COCCICHECK_PATCH_MUST_BE_EMPTY_FILES = $(COCCICHECK_PATCHES_INTREE)\n endif\n coccicheck: $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES)\n-\t! grep -q ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null\n+\t! grep ^ $(COCCICHECK_PATCH_MUST_BE_EMPTY_FILES) /dev/null\n \n # See contrib/coccinelle/README\n coccicheck-pending: coccicheck-test\n-- \n2.52.0-357-gead5eaf5b3\n\n"},{"id":"532112","messageId":"20251213014628.3380826-3-gitster@pobox.com","threadId":"64619","inReplyTo":"20251213014628.3380826-1-gitster@pobox.com","subject":"[PATCH 2/2] cocci: use MEMZERO_ARRAY() a bit more","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-12-13T01:46:28Z","receivedAt":"2025-12-13T01:46:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Existing code in files that have been fairly stable trigger the\n\"make coccicheck\" suggestions due to the new check.\n\nRewrite them to use MEMZERO_ARRAY()\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n diffcore-delta.c    | 4 ++--\n linear-assignment.c | 4 ++--\n shallow.c           | 4 ++--\n 3 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/diffcore-delta.c b/diffcore-delta.c\nindex ba6cbee76b..2de9e9ccff 100644\n--- a/diffcore-delta.c\n+++ b/diffcore-delta.c\n@@ -56,7 +56,7 @@ static struct spanhash_top *spanhash_rehash(struct spanhash_top *orig)\n \t\t\t     st_mult(sizeof(struct spanhash), sz)));\n \tnew_spanhash->alloc_log2 = orig->alloc_log2 + 1;\n \tnew_spanhash->free = INITIAL_FREE(new_spanhash->alloc_log2);\n-\tmemset(new_spanhash->data, 0, sizeof(struct spanhash) * sz);\n+\tMEMZERO_ARRAY(new_spanhash->data, sz);\n \tfor (i = 0; i < osz; i++) {\n \t\tstruct spanhash *o = &(orig->data[i]);\n \t\tint bucket;\n@@ -135,7 +135,7 @@ static struct spanhash_top *hash_chars(struct repository *r,\n \t\t\t      st_mult(sizeof(struct spanhash), (size_t)1 << i)));\n \thash->alloc_log2 = i;\n \thash->free = INITIAL_FREE(i);\n-\tmemset(hash->data, 0, sizeof(struct spanhash) * ((size_t)1 << i));\n+\tMEMZERO_ARRAY(hash->data, ((size_t)1 << i));\n \n \tn = 0;\n \taccum1 = accum2 = 0;\ndiff --git a/linear-assignment.c b/linear-assignment.c\nindex 5416cbcf40..97b4f75058 100644\n--- a/linear-assignment.c\n+++ b/linear-assignment.c\n@@ -20,8 +20,8 @@ void compute_assignment(int column_count, int row_count, int *cost,\n \tint i, j, phase;\n \n \tif (column_count < 2) {\n-\t\tmemset(column2row, 0, sizeof(int) * column_count);\n-\t\tmemset(row2column, 0, sizeof(int) * row_count);\n+\t\tMEMZERO_ARRAY(column2row, column_count);\n+\t\tMEMZERO_ARRAY(row2column, row_count);\n \t\treturn;\n \t}\n \ndiff --git a/shallow.c b/shallow.c\nindex d9cd4e219c..c20471cd7e 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -713,7 +713,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,\n \n \tif (used) {\n \t\tint bitmap_size = DIV_ROUND_UP(pi.nr_bits, 32) * sizeof(uint32_t);\n-\t\tmemset(used, 0, sizeof(*used) * info->shallow->nr);\n+\t\tMEMZERO_ARRAY(used, info->shallow->nr);\n \t\tfor (i = 0; i < nr_shallow; i++) {\n \t\t\tconst struct commit *c = lookup_commit(the_repository,\n \t\t\t\t\t\t\t       &oid[shallow[i]]);\n@@ -782,7 +782,7 @@ static void post_assign_shallow(struct shallow_info *info,\n \n \ttrace_printf_key(&trace_shallow, \"shallow: post_assign_shallow\\n\");\n \tif (ref_status)\n-\t\tmemset(ref_status, 0, sizeof(*ref_status) * info->ref->nr);\n+\t\tMEMZERO_ARRAY(ref_status, info->ref->nr);\n \n \t/* Remove unreachable shallow commits from \"theirs\" */\n \tfor (i = dst = 0; i < info->nr_theirs; i++) {\n-- \n2.52.0-357-gead5eaf5b3\n\n"},{"id":"532159","messageId":"aT-ZLICiwcX_eAgn@pks.im","threadId":"64619","inReplyTo":"20251213014628.3380826-2-gitster@pobox.com","subject":"Re: [PATCH 1/2] coccicheck: emit the contents of cocci patch","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-12-15T05:14:20Z","receivedAt":"2025-12-15T05:14:28Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Sat, Dec 13, 2025 at 10:46:27AM +0900, Junio C Hamano wrote:\n> Telling the user \"you got some error messages\" without showing what\n> the errors are is almost useless in CI environment, as the errors\n> cannot be examined without downloading build artifacts.\n> \n> Arrange it to spew out the output when it fails.\n\nOh yes, please. I recently had CI fail and wanted to do a similar change\nalready, but you beat me to it. Thanks!\n\nPatrick\n"}]}