From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id WAA04085 for ; Tue, 8 Aug 1995 22:11:52 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA07097 (5.65c/Gatech-10.0-IDA for ); Tue, 8 Aug 1995 08:06:36 -0400 Received: by math (5.x/SMI-SVR4) id AA03463; Tue, 8 Aug 1995 08:01:46 -0400 Resent-Date: Tue, 08 Aug 95 12:36:08 +0100 Old-Return-Path: Message-Id: <18380.9508081136@pyro.swan.ac.uk> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: COMPLETE_IN_WORD dumps core if reserved word match In-Reply-To: "kaefer@aglaia.snafu.de"'s message of "Mon, 07 Aug 95 13:51:33 +0200." Date: Tue, 08 Aug 95 12:36:08 +0100 From: P.Stephenson@swansea.ac.uk X-Mts: smtp Resent-Message-Id: <"oZVJH.0.1s.f8r9m"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/293 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu kaefer@aglaia.snafu.de wrote: > I wrote, > Subject: COMPLETE_IN_WORD dumps core if built-in functions match, > > > The obvious way around (at least for GCC) is to recompile with > > -fwritable-strings. > > The fix is to copy these words, at the expense of a-hundred-and-a- > few bytes increased memory usage, as it was done in earlier releases. Yuk. Having to copy permanent values is not much more `politically correct' than using -fwritable-strings. Why can't we just call dupstring() before sticking in the null byte? I don't see why `s' should have to point to the original string rather than a copy. There was a line like this t = s += (ispattern ? 0 : pl); e += t - s; but surely the second line is redundant? Anyway, I deleted it. *** Src/zle_tricky.c.sav Fri Jul 28 12:47:31 1995 --- Src/zle_tricky.c Tue Aug 8 12:29:37 1995 *************** *** 1395,1401 **** addmatch(char *s, char *t) { int test = 0, sl = strlen(s), pl = rpl, cc = 0, *bp, *ep; ! char sav = 0, *e = NULL, *tt, *te, *fc, **fm; Comp cp = patcomp; Param pm; LinkList l = matches; --- 1395,1401 ---- addmatch(char *s, char *t) { int test = 0, sl = strlen(s), pl = rpl, cc = 0, *bp, *ep; ! char *e = NULL, *tt, *te, *fc, **fm; Comp cp = patcomp; Param pm; LinkList l = matches; *************** *** 1513,1528 **** if (!test) return; ! t = s += (ispattern ? 0 : pl); ! e += t - s; ! s = t; ! ! if (ispattern) ! e = NULL, sav = '\0'; ! else { ! if ((sav = *e)) { ! *e = '\0'; ! t = dupstring(t); } } --- 1513,1526 ---- if (!test) return; ! if (ispattern) { ! t = s; ! } else { ! t = s += pl; ! if (*e) { ! sl = e - s; ! t = s = dupstring(t); ! s[sl] = '\0'; } } *************** *** 1561,1568 **** fshortl = sl, fshortest = t; else shortl = sl, shortest = t; - if (sav) - *e = sav; } #ifdef HAVE_NIS --- 1559,1564 ---- -- Peter Stephenson Tel: +44 1792 205678 extn. 4461 WWW: http://python.swan.ac.uk/~pypeters/ Fax: +44 1792 295324 Department of Physics, University of Wales, Swansea, Singleton Park, Swansea, SA2 8PP, U.K.