Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: COMPLETE_IN_WORD dumps core if reserved word match
- X-seq: zsh-workers 293
- From: P.Stephenson@xxxxxxxxxxxxx
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: COMPLETE_IN_WORD dumps core if reserved word match
- Date: Tue, 08 Aug 95 12:36:08 +0100
- In-reply-to: "kaefer@xxxxxxxxxxxxxxx"'s message of "Mon, 07 Aug 95 13:51:33 +0200." <m0sfQiU-00007BC@xxxxxxxxxxxxxxx>
kaefer@xxxxxxxxxxxxxxx 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 <P.Stephenson@xxxxxxxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author