zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] isearch: do not use PAT_STATIC since we call zle hooks
Date: Sat, 28 Jan 2017 11:02:24 -0800 (PST)	[thread overview]
Message-ID: <alpine.LRH.2.00.1701281048330.4560@toltec.zanshin.com> (raw)
In-Reply-To: <20170108194021.18fb2011@ntlworld.com>

On Sun, 8 Jan 2017, Peter Stephenson wrote:

> On Sun, 8 Jan 2017 11:33:58 -0800
> Bart Schaefer <schaefer@brasslantern.com> wrote:
> > PAT_STATIC already causes the compiled pattern to be placed on the heap,
> > so we could introduce a PAT_HEAPDUP that works like PAT_ZDUP except
> > there would be no need to explicity freepatprog().
>
> That sounds like a good idea.

Of course I had this wrong -- the pattern is by default in a never-freed
block of zalloc'd memory used by the pattern compiler, and PAT_STATIC
causes it to remain there.  (I misread a "!" in a conditional.)

So PAT_HEAPDUP is already there, it's just (not PAT_STATIC) ... and we
are back to deciding whether each individual use of PAT_STATIC is safe
WRT signals and hooks.

Should we make it explicit anyway?

diff --git a/Src/zsh.h b/Src/zsh.h
index d022260..c387414 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1531,6 +1531,7 @@ struct patstralloc {

 /* Flags used in pattern matchers (Patprog) and passed down to patcompile */

+#define PAT_HEAPDUP	0x0000	/* Dummy flag for default behavior */
 #define PAT_FILE	0x0001	/* Pattern is a file name */
 #define PAT_FILET	0x0002	/* Pattern is top level file, affects ~ */
 #define PAT_ANY		0x0004	   /* Match anything (cheap "*") */


  reply	other threads:[~2017-01-28 19:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 17:25 m0viefreak
2017-01-06 17:35 ` Bart Schaefer
2017-01-08 19:33 ` Bart Schaefer
2017-01-08 19:40   ` Peter Stephenson
2017-01-28 19:02     ` Bart Schaefer [this message]
2017-01-28 19:15       ` Peter Stephenson
2017-01-28 19:39       ` Bart Schaefer
2017-01-28 19:47         ` Peter Stephenson
2017-01-29  0:01           ` Bart Schaefer
2017-01-29 16:24             ` Bart Schaefer
2017-01-09  1:35 ` Daniel Shahaf
2017-01-09  1:48   ` Bart Schaefer
2017-01-11  2:01     ` Fwd: " Bart Schaefer

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=alpine.LRH.2.00.1701281048330.4560@toltec.zanshin.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).