Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Several PCRE module oddities
- X-seq: zsh-workers 32896
- From: "Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Several PCRE module oddities
- Date: Wed, 23 Jul 2014 22:18:21 +0900
- In-reply-to: <140720095545.ZM20143@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20140719121937.GN12213@bunkus.org> <20140719123158.GO12213@bunkus.org> <20140719123620.GP12213@bunkus.org> <20140719123645.GQ12213@bunkus.org> <140719152116.ZM13686@torch.brasslantern.com> <20140720102409.GS11492@isis.sigpipe.cz> <140720095545.ZM20143@torch.brasslantern.com>
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