zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: zsh-workers@zsh.org
Subject: [PATCH] re2: fix clean-up path; fix two comments
Date: Thu, 8 Sep 2016 09:56:00 -0400	[thread overview]
Message-ID: <20160908135559.GA10762@breadbox.private.spodhuis.org> (raw)
In-Reply-To: <20160908041556.GA8401@breadbox.private.spodhuis.org>

[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]

On 2016-09-08 at 00:15 -0400, Phil Pennock wrote:
> I've also pushed this code to a GitHub repo, philpennock/zsh-code on the
> re2 branch: https://github.com/philpennock/zsh-code/tree/re2

This change is there too.

> (Oh, I can't spell "tough", it seems; deferring fix for now).

Fixed.  Also fixed a bug described just below in the patch body, and
swapped a FIXME comment for a TODO, referencing whatever future work
changes =~ binding.  (Feedback on that idea, outlined in previous mail,
appreciated!)

-Phil

----------------------------8< git patch >8-----------------------------

The clean-up path is for an internal function being passed an id which
it can't handle, but the ids come from this file, so it's protection
against coding mistakes in future extension.  In that hypothetical case,
we'd leak the memory of one RE2 opt object each time the matching
function was called in the unhandled id-profile.

Also clean up two comments.
---
 Src/Modules/re2.c | 4 ++--
 Test/V11re2.ztst  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Src/Modules/re2.c b/Src/Modules/re2.c
index e542723..f6a5283 100644
--- a/Src/Modules/re2.c
+++ b/Src/Modules/re2.c
@@ -28,7 +28,7 @@
  */
 
 /* This is heavily based upon my earlier regex module, with Peter's fixes
- * for the tought stuff I had skipped / gotten wrong. */
+ * for the tougher stuff I had skipped / gotten wrong. */
 
 #include "re2.mdh"
 #include "re2.pro"
@@ -106,7 +106,7 @@ zcond_re2_match(char **a, int id)
 	break;
     default:
 	DPUTS(1, "bad re2 option");
-	goto CLEANUP_UNMETAONLY;
+	goto CLEANUP_OPT;
     }
 
     rex = cre2_new(rhre, strlen(rhre), opt);
diff --git a/Test/V11re2.ztst b/Test/V11re2.ztst
index d6e327c..823a5ef 100644
--- a/Test/V11re2.ztst
+++ b/Test/V11re2.ztst
@@ -7,7 +7,7 @@
   fi
 # Load the rest of the builtins
   zmodload zsh/re2
-  ##FIXME#setopt rematch_pcre
+  # TODO: use future mechanism to switch =~ to use re2 and test =~ too
 # Find a UTF-8 locale.
   setopt multibyte
 # Don't let LC_* override our choice of locale.
-- 
2.10.0


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2016-09-08 13:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  4:15 [PATCH] Add zsh/re2 module with conditions Phil Pennock
2016-09-08 13:56 ` Phil Pennock [this message]
2016-09-08 21:14 ` Oliver Kiddle
2016-09-08 21:48   ` Phil Pennock
     [not found] ` <20160908144203.GA28545@fujitsu.shahaf.local2>
     [not found]   ` <20160908204737.GA12164@breadbox.private.spodhuis.org>
     [not found]     ` <20160908211643.GA4432@fujitsu.shahaf.local2>
     [not found]       ` <20160909005557.GB12371@breadbox.private.spodhuis.org>
     [not found]         ` <20160909045739.GA6623@fujitsu.shahaf.local2>
     [not found]           ` <20160910010456.GA85981@tower.spodhuis.org>
     [not found]             ` <20160910190924.GB4045@fujitsu.shahaf.local2>
2016-09-11 19:23               ` zsh/re2 : avoid until further notice Phil Pennock
2016-09-11 19:27                 ` Phil Pennock
2016-09-12  3:50                 ` Daniel Shahaf
2016-09-14 18:47                   ` Phil Pennock

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=20160908135559.GA10762@breadbox.private.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --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).