Skip to content

Commit 516a9ec

Browse files
peffgitster
authored andcommitted
grep: prefer UNUSED to MAYBE_UNUSED for pcre allocators
We provide custom malloc/free callbacks for the pcre library to use. Those take an extra "data" parameter, but we don't use it. Back when these were added in 513f2b0 (grep: make PCRE2 aware of custom allocator, 2019-10-16), we only had MAYBE_UNUSED. But these days we have UNUSED, which we should prefer, as it will let the compiler inform us if the code changes to actually use the parameters. I also moved the annotations to come after the variable name, which is how we typically spell it. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3cdddcf commit 516a9ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

grep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static int is_fixed(const char *s, size_t len)
245245
#ifdef USE_LIBPCRE2
246246
#define GREP_PCRE2_DEBUG_MALLOC 0
247247

248-
static void *pcre2_malloc(PCRE2_SIZE size, MAYBE_UNUSED void *memory_data)
248+
static void *pcre2_malloc(PCRE2_SIZE size, void *memory_data UNUSED)
249249
{
250250
void *pointer = malloc(size);
251251
#if GREP_PCRE2_DEBUG_MALLOC
@@ -255,7 +255,7 @@ static void *pcre2_malloc(PCRE2_SIZE size, MAYBE_UNUSED void *memory_data)
255255
return pointer;
256256
}
257257

258-
static void pcre2_free(void *pointer, MAYBE_UNUSED void *memory_data)
258+
static void pcre2_free(void *pointer, void *memory_data UNUSED)
259259
{
260260
#if GREP_PCRE2_DEBUG_MALLOC
261261
static int count = 1;

0 commit comments

Comments
 (0)