diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-12-23 11:33:16 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-12-23 11:33:16 +0900 |
| commit | 396df67739bed1615e92071961e3e4d2bf378c16 (patch) | |
| tree | aebed06b96b6cb69243d1eccab1c0450068f89c7 /git-compat-util.h | |
| parent | c77ba76807f30c2d69febbe8ad1f6b03ba4314f1 (diff) | |
| parent | 467860bc0b0447093ae97bcecf1655131732338f (diff) | |
| download | git-396df67739bed1615e92071961e3e4d2bf378c16.tar.xz | |
Merge branch 'tc/memzero-array'
MEMZERO_ARRAY() helper is introduced to avoid clearing only the
first N bytes of an N-element array whose elements are larger than
a byte.
* tc/memzero-array:
contrib/coccinelle: pass include paths to spatch(1)
git-compat-util: introduce MEMZERO_ARRAY() macro
Diffstat (limited to 'git-compat-util.h')
| -rw-r--r-- | git-compat-util.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 398e0fac4f..2b8192fd2e 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -726,6 +726,7 @@ static inline uint64_t u64_add(uint64_t a, uint64_t b) #define ALLOC_ARRAY(x, alloc) (x) = xmalloc(st_mult(sizeof(*(x)), (alloc))) #define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x))) #define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), st_mult(sizeof(*(x)), (alloc))) +#define MEMZERO_ARRAY(x, alloc) memset((x), 0x0, st_mult(sizeof(*(x)), (alloc))) #define COPY_ARRAY(dst, src, n) copy_array((dst), (src), (n), sizeof(*(dst)) + \ BARF_UNLESS_COPYABLE((dst), (src))) |
