Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Re: Two more (possible) problems with the new completion...



Peter Stephenson wrote:

> 
> Sven Wischnowsky wrote:
> > `-W' behaves like `-k', you only need `compctl -W cdpath -/ cd'. There 
> > is some extra hacklet that ensures that the old style (giving one
> > directory) still works (in most cases): if the string isn't an
> > parameter name, it is used directly as a directory name. So, unless
> > you have a directory named `$cdpath' (*not* the value of `cdpath') it
> > will produce no matches.
> 
> Fine, but ... :-)
> 
> In this case the return value of get_user_var() is a pointer to the
> stored array itself, so the array shouldn't be modified.  The present
> code does a mischief to the value of $cdpath after the completion is
> finished.  The patch below fixes it (I can even do this one myself).

Thanks. The patch below goes on top of this, just to keep gcc quiet.

BTW, in the Peter's glob patch he added some braces to keep gcc from
emitting lots of `ambiguous else' warnings and I've similiar things in 
zle_tricky.c. We should remember to fix all of these (and the `char
used as subscript' warnings) before the next official release.
all th

Bye
 Sven

*** os/Zle/zle_tricky.c	Thu Nov  5 14:17:03 1998
--- Src/Zle/zle_tricky.c	Thu Nov  5 14:17:08 1998
***************
*** 3848,3854 ****
  
  		    if ((pp = get_user_var(cc->withd))) {
  			dirs = npp =
! 			    (char*) halloc(sizeof(char *)*(arrlen(pp)+1));
  			while (*pp) {
  			    pl = strlen(*pp);
  			    tp = (char *) halloc(strlen(*pp) + tl);
--- 3848,3854 ----
  
  		    if ((pp = get_user_var(cc->withd))) {
  			dirs = npp =
! 			    (char**) halloc(sizeof(char *)*(arrlen(pp)+1));
  			while (*pp) {
  			    pl = strlen(*pp);
  			    tp = (char *) halloc(strlen(*pp) + tl);


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author