Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Several PCRE module oddities



On 2014/07/21, at 01:55, Bart Schaefer wrote:
> I was thinking more of using offset_start < 0 as a flag for whether the
> -n option appears at all, since the return value of getposint() can be
> independently examined.
> 
> Here's a new patch, 
(snip)
> -    int offset_start = 0;
> +    int offset_start = -1;
(snip)
> -    if (offset_start < 0 || offset_start >= subject_len)
> +    if (offset_start > 0 && offset_start >= subject_len)

With this patch, if the -n option is not given, then offset_start remains
as -1 and pcre_exec() (line 314)

    ret = pcre_exec(pcre_pattern, pcre_hints, plaintext, subject_len, offset_start, 0, ovec, ovecsize);

fails with ret==-24, and V07pcre.ztst fails with errors like 

Error output:
(eval):pcre_match:2: error in pcre_exec [-24]

Maybe offset_start can be initialized to 0 as in the original code?


Messages sorted by: Reverse Date, Date, Thread, Author