zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] Several PCRE module oddities
Date: Wed, 23 Jul 2014 08:26:09 -0700	[thread overview]
Message-ID: <140723082609.ZM3698@torch.brasslantern.com> (raw)
In-Reply-To: <809CC6B3-5CCA-4D7C-AA4A-96661193917F@kba.biglobe.ne.jp>

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) {


      reply	other threads:[~2014-07-23 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140719121937.GN12213@bunkus.org>
     [not found] ` <20140719123158.GO12213@bunkus.org>
     [not found]   ` <20140719123620.GP12213@bunkus.org>
     [not found]     ` <20140719123645.GQ12213@bunkus.org>
     [not found]       ` <140719152116.ZM13686@torch.brasslantern.com>
     [not found]         ` <20140720102409.GS11492@isis.sigpipe.cz>
2014-07-20 16:55           ` [PATCH] " Bart Schaefer
2014-07-23 13:18             ` [PATCH] " Jun T.
2014-07-23 15:26               ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140723082609.ZM3698@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).