Re: [pcre-dev] pcretest in 8.20

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: xgl001
CC: pcre-dev
Subject: Re: [pcre-dev] pcretest in 8.20
On Sat, 5 Nov 2011, xgl001 wrote:

> Yes but pcregrep is coded with multiple #ifdef SUPPORT_PCREGREP_JIT,
> a new conditional established in config.h for that program.


That was really a "just in case someone needs it" option.

> During a transition these #defines left me thinking of what to do
> from the perspective of programs using PCRE (vs. building PCRE).
> They see pcre.h but not PCRE's own config.h for SUPPORT_JIT.
> For the transition I've temporarily changed to:
>
> #ifdef PCRE_INFO_JIT
>     pcre_free_study (our_study_ptr);
> #else
>     pcre_free (our_study_ptr);
> #endif

>
> Code built with a pcre.h version less than 8.20 must use pcre_free().
> Newer code should from now on use pcre_free_study() for releasing
> a study allocation, and continue to use pcre_free() for
> pcre_compile() and pcre_compile2() allocations.


Good point. I guess that could be documented, and the way you have done
it seems as good as any. However, if you are *not* using JIT, the use of
pcre_free() for a study allocation is still OK. So old programs should
continue to work with 8.20 and later releases without modification.

Any program that expects to be built with different versions of PCRE
should surround any JIT-related code with #ifdef PCRE_INFO_JIT (or
PCRE_STUDY_JIT_COMPILE) as well as do what you have done above.

Philip

--
Philip Hazel