From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15565 invoked by alias); 23 Jul 2014 15:26:18 -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: 32898 Received: (qmail 19596 invoked from network); 23 Jul 2014 15:26:17 -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 From: Bart Schaefer Message-id: <140723082609.ZM3698@torch.brasslantern.com> Date: Wed, 23 Jul 2014 08:26:09 -0700 In-reply-to: <809CC6B3-5CCA-4D7C-AA4A-96661193917F@kba.biglobe.ne.jp> Comments: In reply to "Jun T." "Re: [PATCH] Several PCRE module oddities" (Jul 23, 10:18pm) 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> <809CC6B3-5CCA-4D7C-AA4A-96661193917F@kba.biglobe.ne.jp> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "zsh-workers@zsh.org" Subject: Re: [PATCH] Several PCRE module oddities MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jul 23, 10:18pm, Jun T. wrote: } Subject: 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. } } With this patch, if the -n option is not given, then offset_start remains } as -1 and pcre_exec() (line 314) Well, drat. I was sure I'd run "make check". How did I miss that? } Maybe offset_start can be initialized to 0 as in the original code? Yes, thinko on my part. I started with the idea that -n 0 was a case that needed to be differentiated, but in the end that doesn't seem to be the case. Thanks for catching. diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 0e43ab7..040a33f 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -274,7 +274,7 @@ bin_pcre_match(char *nam, char **args, Options ops, UNUSED(int func)) int return_value = 1; /* The subject length and offset start are both int values in pcre_exec */ int subject_len; - int offset_start = -1; + int offset_start = 0; int want_offset_pair = 0; if (pcre_pattern == NULL) {