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

Αρχική Σελίδα
Delete this message
Συντάκτης: ph10
Ημερομηνία:  
Προς: Ralf Junker
Υ/ο: pcre-dev@exim.org
Αντικείμενο: 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