From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30 invoked by alias); 28 Jan 2017 19:03:00 -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: 40439 Received: (qmail 1511 invoked from network); 28 Jan 2017 19:03:00 -0000 X-Qmail-Scanner-Diagnostics: from mercury.zanshin.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(64.84.47.142):SA:0(-0.0/5.0):. Processed in 1.030349 secs); 28 Jan 2017 19:03:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at ipost.com designates 64.84.47.142 as permitted sender) Date: Sat, 28 Jan 2017 11:02:24 -0800 (PST) From: Bart Schaefer Reply-To: Bart Schaefer To: zsh-workers@zsh.org Subject: Re: [PATCH] isearch: do not use PAT_STATIC since we call zle hooks In-Reply-To: <20170108194021.18fb2011@ntlworld.com> Message-ID: References: <20170106172541.GA14113@fujitsu.shahaf.local2> <170108113358.ZM9462@torch.brasslantern.com> <20170108194021.18fb2011@ntlworld.com> User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) X-Face: "f/X=UCVgd*^c>+x(gMq0at?e:woX+;'snkkRzc3SX<0AZ (/PS4.M2hzGS9X:Qj]at_H/%a9K}:-eS<"v_7vX84PG9Bf Zpb`wI!I4geY=or+nWq`3CX`oq&TJR;g^ps|7(MH?jh;bs %vHJfCh5>a*6Re5m|Bidja\\o]>n\A)ib1:yX*T`zR(*h~ %tOw<~!D9{e6h!8M2:d8G2@K>y^1I_Vdy\d\MYe]z7c MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sun, 8 Jan 2017, Peter Stephenson wrote: > On Sun, 8 Jan 2017 11:33:58 -0800 > Bart Schaefer 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 "*") */