Re: [pcre-dev] PCRE2_ERROR_BADOFFSET does not fill match_dat…

Top Page
Delete this message
Author: ph10
Date:  
To: Ralf Junker
CC: pcre-dev@exim.org
Subject: Re: [pcre-dev] PCRE2_ERROR_BADOFFSET does not fill match_data et al.
On Sun, 21 Dec 2014, Ralf Junker wrote:

> Rationale: match_data->rc is left be uninitialized or contain values from a
> previous match. pcre2_substring_length_bynumber() thus behaves unpredictably
> in case of PCRE2_ERROR_BADOFFSET.


I have updated the documentation to make it clear when the
pcre2_substring_xxx functions can be called (only after success or
PCRE2_ERROR_PARTIAL, basically). In particular, they must not be called
after errors such as PCRE2_ERROR_BADOFFSET. I have also done the same
for the other functions that extract information from the match data.

> Related to this, pcre2_substring_length_bynumber() does not take into
> consideration PCRE2_ERROR_PARTIAL and does not return the substring length of
> a partially matched pattern.


I have fixed that. Only substring 0 is available after a partial match,
however.

> pcre2_substring_length_bynumber.3 was left out when improving the interfaces
> to substring functions in PCRE2 SVN #173.


I have also fixed that.

Thanks again for your feedback.

Philip

--
Philip Hazel