[pcre-dev] [Bug 1134] pcre_fullinfo gives incorrect info for…

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1134] pcre_fullinfo gives incorrect info for PCRE_INFO_STUDYSIZE
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1134




--- Comment #7 from Philip Hazel <ph10@???> 2011-08-15 17:33:12 ---
On Mon, 15 Aug 2011, Zoltan Herczeg wrote:

> --- Comment #6 from Zoltan Herczeg <hzmester@???> 2011-08-15 10:48:47 ---
> Probably a seralizer/deserializer could help on this. The serializer would
> create a continous memory region from the study data for saving it, and the
> serializer would do the opposite.


The pcretest program has code for saving/restoring compiled patterns and
their study data, so that this feature can be included in the standard
tests.

I am rather embarrassed at the coding in pcretest.c; I originally hacked
up a "quick test program" back in the days of release 1.00. I should
have known better and written it rather more neatly and carefully. I
keep meaning to rewrite it, but somehow there's always been something
more urgent/important, and of course the program has been hacked about
more and more and additional testing features were needed. Oh well...

Anyway, my point is that you can study the code in pcretest.c to help
with saving and restoring. Grep for the code near the text "Compiled
pattern written to" for how it saves and ""Compiled pattern%s loaded
from" for how it reloads. It does NOT save the pcre_extra block, just
the single block pointed at by the extra->study_data field.

When reloading, it gets a single block of memory for the pcre_extra
block and the study data, but this is just for convenience. There is no
reason why you couldn't set these up as two separate blocks if you
wanted to.

I hope this helps.

Regards,
Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email