From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2907 invoked by alias); 23 Jul 2014 13:19:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32896 Received: (qmail 6131 invoked from network); 23 Jul 2014 13:18:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: [PATCH] Several PCRE module oddities From: "Jun T." In-Reply-To: <140720095545.ZM20143@torch.brasslantern.com> Date: Wed, 23 Jul 2014 22:18:21 +0900 Content-Transfer-Encoding: quoted-printable Message-Id: <809CC6B3-5CCA-4D7C-AA4A-96661193917F@kba.biglobe.ne.jp> 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> To: "zsh-workers@zsh.org" X-Mailer: Apple Mail (2.1510) X-Biglobe-Spnum: 50881 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. >=20 > Here's a new patch,=20 (snip) > - int offset_start =3D 0; > + int offset_start =3D -1; (snip) > - if (offset_start < 0 || offset_start >=3D subject_len) > + if (offset_start > 0 && offset_start >=3D subject_len) With this patch, if the -n option is not given, then offset_start = remains as -1 and pcre_exec() (line 314) ret =3D pcre_exec(pcre_pattern, pcre_hints, plaintext, subject_len, = offset_start, 0, ovec, ovecsize); fails with ret=3D=3D-24, and V07pcre.ztst fails with errors like=20 Error output: (eval):pcre_match:2: error in pcre_exec [-24] Maybe offset_start can be initialized to 0 as in the original code?=