From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20007 invoked by alias); 23 Feb 2015 14:06:13 -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: 34617 Received: (qmail 14842 invoked from network); 23 Feb 2015 14:06:12 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc86d0000066b7-fb-54eb333b0822 Date: Mon, 23 Feb 2015 14:05:41 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: PATCH: Remeta one frame earlier Message-id: <20150223140541.6cdb0fc2@pwslap01u.europe.root.pri> In-reply-to: <1424699469-11744-1-git-send-email-mikachu@gmail.com> References: <1424699469-11744-1-git-send-email-mikachu@gmail.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOLMWRmVeSWpSXmKPExsVy+t/xy7rWxq9DDLauk7A42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGZNvb2Av2MpVcafxDEsDYy97FyMnh4SAiUTnw1fMELaYxIV7 69m6GLk4hASWMko0TvjAAuEsYZL4MmcfE4SzjVFiysb9TCAtLAKqEo+2rmEFsdkEDCWmbprN CGKLCIhLnF17ngXEFhbQkfg+5x/YCl4Be4kf35vBejkFnCROTzjEDjG0i1Fi9ownYIP4BfQl rv79xARxk73EzCtnGCGaBSV+TL4HNpRZQEti87YmVghbXmLzmrdgC4QE1CVu3N3NPoFRaBaS lllIWmYhaVnAyLyKUTS1NLmgOCk910ivODG3uDQvXS85P3cTIyRwv+5gXHrM6hCjAAejEg/v g7JXIUKsiWXFlbmHGCU4mJVEeN/ovg4R4k1JrKxKLcqPLyrNSS0+xMjEwSnVwOgomVTw7v+L eiFG3o8pFS3FPiyMU/XmV+gsCb8Z2H1pL2/q8nlRZf6f1t4NXDNFIHNS+WOul3M/6fP961l4 KUvicV5GvA2b7MOQoDVWXuK+unMU7tQ+Li967P91ptFyXpOyxtIGLmnmM9Jl7xvOtuft0713 i7F20aXyGdXsv88FSrMw93z4pMRSnJFoqMVcVJwIABNBc+86AgAA On Mon, 23 Feb 2015 14:51:09 +0100 Mikael Magnusson wrote: > + int remeta; > > if (l < 0) { > zerr("corrupt history file %s", fn); > break; > } > + > + /* > + * Handle the special case that we're reading from an > + * old shell with fewer meta characters, so we need to > + * metafy some more. (It's not clear why the history > + * file is metafied at all; some would say this is plain > + * stupid. But we're stuck with it now without some > + * hairy workarounds for compatibility). > + * > + * This is rare so doesn't need to be that efficient; just > + * allocate space off the heap. > + */ > + for (ptr = pt; *ptr; ptr++) { > + if (*ptr == Meta && ptr[1]) > + ptr++; > + else if (imeta(*ptr)) { > + remeta = 1; > + break; > + } > + } > + if (remeta) { > + unmetafy(pt, &remeta); > + pt = metafy(pt, remeta, META_USEHEAP); > + } > + ... except you haven't initialised remeta to 0. If we do stick with the heap, I'm wondering if we need to free it more often than we do. Maybe the freeheap() below should be if (uselex || remeta), and maybe it should be right at the end of the loop for safety. Long discussion for moving a bit of code... pws