path: root/grep.c
diff options
authorHans Jerry Illikainen <>2019-11-27 20:24:11 (GMT)
committerJunio C Hamano <>2019-11-30 22:06:58 (GMT)
commit867fc7f31010f668e18caa3e0825a36c308d3e3b (patch)
tree3cafc64a7ea1cfa6b9f505954fba87565883cc2b /grep.c
parentd9f6f3b6195a0ca35642561e530798ad1469bd41 (diff)
grep: don't return an expression from pcre2_free()
Previously, the void pcre2_free() function in grep.c returned free(). While free() itself is void, afaict it's still an expression as per section A.2.3, subsection 6.8.6 (jump-statement) in both C99 [1] and C11 [2]: > return expression Section in C99 [1] and C11 [2] says that: > A return statement with an expression shall not appear in a function > whose return type is void. The consequence of the old behavior was that developer builds with pedantic errors enabled broke Git if PCRE2 was enabled and a smart-enough compiler to detect these errors was used. This commit fixes pedantic builds of Git that enables --with-libpcre. [1] [2] Signed-off-by: Hans Jerry Illikainen <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'grep.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/grep.c b/grep.c
index b7ae5a4..0552b12 100644
--- a/grep.c
+++ b/grep.c
@@ -26,7 +26,7 @@ static void *pcre2_malloc(PCRE2_SIZE size, MAYBE_UNUSED void *memory_data)
static void pcre2_free(void *pointer, MAYBE_UNUSED void *memory_data)
- return free(pointer);
+ free(pointer);