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

Re: improvement in builtin addition/deletion



Zefram wrote:
> This patch adds two new functions, addbuiltins() and deletebuiltins().
> They add and delete several builtins at once, in the manner of the code
> I produced for the files module.  They are actually helpful even when
> adding only one builtin: they ensure that error messages are correctly
> generated in all cases.  It also makes adding a second builtin to the
> module as easy as possible.

There is a little bug in that patch, fix is below.

Zoltan


*** Src/module.c.zefram	Sat Dec 28 00:59:10 1996
--- Src/module.c	Sat Dec 28 01:00:03 1996
***************
*** 92,101 ****
  	if(addbuiltin(b->nam, b->binf, b->func,
  	    b->minargs, b->maxargs, b->funcid, b->optstr, b->defopts)) {
  	    zwarnnam(nam, "name clash when adding builtin `%s'", b->nam, 0);
- 	    b->flags |= BINL_ADDED;
  	    hadf = 1;
! 	} else
  	    hads = 2;
      }
      return hadf ? hads : 1;
  }
--- 92,102 ----
  	if(addbuiltin(b->nam, b->binf, b->func,
  	    b->minargs, b->maxargs, b->funcid, b->optstr, b->defopts)) {
  	    zwarnnam(nam, "name clash when adding builtin `%s'", b->nam, 0);
  	    hadf = 1;
! 	} else {
! 	    b->flags |= BINL_ADDED;
  	    hads = 2;
+ 	}
      }
      return hadf ? hads : 1;
  }



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