]> git.ipfire.org Git - thirdparty/git.git/commit - grep.h
grep/pcre2: use pcre2_maketables_free() function
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 18 Feb 2021 00:07:25 +0000 (01:07 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Feb 2021 00:32:19 +0000 (16:32 -0800)
commitb76bf27f6a0138f66f7cfca122b7ddc68836160d
tree567cccbb322096ae51da69765c56baa3635881f7
parent797c359978eb13ddff10974a6c6469e33695606c
grep/pcre2: use pcre2_maketables_free() function

Make use of the pcre2_maketables_free() function to free the memory
allocated by pcre2_maketables().

At first sight it's strange that 10da030ab75 (grep: avoid leak of
chartables in PCRE2, 2019-10-16) which added the free() call here
doesn't make use of the pcre2_free() the author introduced in the
preceding commit in 513f2b0bbd4 (grep: make PCRE2 aware of custom
allocator, 2019-10-16).

The reason is that at the time the function didn't exist. It was first
introduced in PCREv2 version 10.34, released on 2019-11-21.

Let's make use of it behind a macro. I don't think this matters for
anything to do with custom allocators, but it makes our use of PCREv2
more discoverable.

At some distant point in the future we'll be able to drop the version
guard, as nobody will be running a version older than 10.34.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c
grep.h