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

Re: NSS LDAP/TLS crashing



Clint Adams wrote:
> > Looks like there's some interaction between zsh's memory handling and
> > the library functions.  I'm surprised to see zcalloc (which is a zsh
> > function) so near the top of the call stack.  Does zcalloc appear as a
> > symbol in the C library in question?  In that case we probably need to
> > rename it.
> 
> That's it.
> 
> % objdump -T /usr/lib/libz.so.1 | grep zcal
> 00008110 g    DF .text	00000018  Base        zcalloc

So it looks like we now need to second-guess the zlib interface.  Here's
a patch for 4.0; I will commit the 4.1 version directly.

I'd be interested to see what difference, if any, this makes to the
valgrind output.

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.46.4.15
diff -u -r1.46.4.15 builtin.c
--- Src/builtin.c	28 Mar 2003 20:32:47 -0000	1.46.4.15
+++ Src/builtin.c	28 Oct 2003 15:22:03 -0000
@@ -2207,7 +2207,7 @@
 		DPUTS(!shf->funcdef,
 		      "BUG: Calling autoload from empty function");
 	    } else {
-		shf = (Shfunc) zcalloc(sizeof *shf);
+		shf = (Shfunc) zshcalloc(sizeof *shf);
 		shfunctab->addnode(shfunctab, ztrdup(scriptname), shf);
 	    }
 	    shf->flags = on;
@@ -2278,7 +2278,7 @@
 	} else if (on & PM_UNDEFINED) {
 	    /* Add a new undefined (autoloaded) function to the *
 	     * hash table with the corresponding flags set.     */
-	    shf = (Shfunc) zcalloc(sizeof *shf);
+	    shf = (Shfunc) zshcalloc(sizeof *shf);
 	    shf->flags = on;
 	    shf->funcdef = mkautofn(shf);
 	    shfunctab->addnode(shfunctab, ztrdup(*argv), shf);
@@ -2665,11 +2665,11 @@
 		/* The argument is of the form foo=bar, *
 		 * so define an entry for the table.    */
 		if(ops['d']) {
-		    Nameddir nd = hn = zcalloc(sizeof *nd);
+		    Nameddir nd = hn = zshcalloc(sizeof *nd);
 		    nd->flags = 0;
 		    nd->dir = ztrdup(asg->value);
 		} else {
-		    Cmdnam cn = hn = zcalloc(sizeof *cn);
+		    Cmdnam cn = hn = zshcalloc(sizeof *cn);
 		    cn->flags = HASHED;
 		    cn->u.cmd = ztrdup(asg->value);
 		}
Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.28.4.8
diff -u -r1.28.4.8 exec.c
--- Src/exec.c	18 Dec 2002 16:56:27 -0000	1.28.4.8
+++ Src/exec.c	28 Oct 2003 15:22:03 -0000
@@ -688,7 +688,7 @@
     if (!*pp)
 	return NULL;
 
-    cn = (Cmdnam) zcalloc(sizeof *cn);
+    cn = (Cmdnam) zshcalloc(sizeof *cn);
     cn->flags = 0;
     cn->u.name = pp;
     cmdnamtab->addnode(cmdnamtab, ztrdup(arg0), cn);
@@ -3358,7 +3358,7 @@
 	LinkNode node;
 
 	node = doshargs->first;
-	pparams = x = (char **) zcalloc(((sizeof *x) *
+	pparams = x = (char **) zshcalloc(((sizeof *x) *
 					 (1 + countlinknodes(doshargs))));
 	if (isset(FUNCTIONARGZERO)) {
 	    oargv0 = argzero;
@@ -3368,7 +3368,7 @@
 	for (; node; node = node->next, x++)
 	    *x = ztrdup((char *) node->dat);
     } else {
-	pparams = (char **) zcalloc(sizeof *pparams);
+	pparams = (char **) zshcalloc(sizeof *pparams);
 	if (isset(FUNCTIONARGZERO)) {
 	    oargv0 = argzero;
 	    argzero = ztrdup(argzero);
Index: Src/hashtable.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hashtable.c,v
retrieving revision 1.10.4.1
diff -u -r1.10.4.1 hashtable.c
--- Src/hashtable.c	5 Jul 2001 11:47:04 -0000	1.10.4.1
+++ Src/hashtable.c	28 Oct 2003 15:22:03 -0000
@@ -96,7 +96,7 @@
 {
     HashTable ht;
 
-    ht = (HashTable) zcalloc(sizeof *ht);
+    ht = (HashTable) zshcalloc(sizeof *ht);
 #ifdef ZSH_HASH_DEBUG
     ht->next = NULL;
     if(!firstht)
@@ -108,7 +108,7 @@
     ht->printinfo = printinfo ? printinfo : printhashtabinfo;
     ht->tablename = ztrdup(name);
 #endif /* ZSH_HASH_DEBUG */
-    ht->nodes = (HashNode *) zcalloc(size * sizeof(HashNode));
+    ht->nodes = (HashNode *) zshcalloc(size * sizeof(HashNode));
     ht->hsize = size;
     ht->ct = 0;
     ht->scan = NULL;
@@ -458,7 +458,7 @@
     onodes = ht->nodes;
 
     ht->hsize = osize * 4;
-    ht->nodes = (HashNode *) zcalloc(ht->hsize * sizeof(HashNode));
+    ht->nodes = (HashNode *) zshcalloc(ht->hsize * sizeof(HashNode));
     ht->ct = 0;
 
     /* scan through the old list of nodes, and *
@@ -496,7 +496,7 @@
      * we free it and allocate a new nodes array.          */
     if (ht->hsize != newsize) {
 	zfree(ht->nodes, ht->hsize * sizeof(HashNode));
-	ht->nodes = (HashNode *) zcalloc(newsize * sizeof(HashNode));
+	ht->nodes = (HashNode *) zshcalloc(newsize * sizeof(HashNode));
 	ht->hsize = newsize;
     } else {
 	/* else we just re-zero the current nodes array */
@@ -639,7 +639,7 @@
 
     while ((fn = zreaddir(dir, 1))) {
 	if (!cmdnamtab->getnode(cmdnamtab, fn)) {
-	    cn = (Cmdnam) zcalloc(sizeof *cn);
+	    cn = (Cmdnam) zshcalloc(sizeof *cn);
 	    cn->flags = 0;
 	    cn->u.name = dirp;
 	    cmdnamtab->addnode(cmdnamtab, ztrdup(fn), cn);
@@ -654,7 +654,7 @@
 	    (exe[3] == 'E' || exe[3] == 'e') && exe[4] == 0) {
 	    *exe = 0;
 	    if (!cmdnamtab->getnode(cmdnamtab, fn)) {
-		cn = (Cmdnam) zcalloc(sizeof *cn);
+		cn = (Cmdnam) zshcalloc(sizeof *cn);
 		cn->flags = 0;
 		cn->u.name = dirp;
 		cmdnamtab->addnode(cmdnamtab, ztrdup(fn), cn);
@@ -1048,7 +1048,7 @@
 {
     Alias al;
 
-    al = (Alias) zcalloc(sizeof *al);
+    al = (Alias) zshcalloc(sizeof *al);
     al->flags = flags;
     al->text = txt;
     al->inuse = 0;
Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.28.4.10
diff -u -r1.28.4.10 hist.c
--- Src/hist.c	14 Jun 2002 17:53:24 -0000	1.28.4.10
+++ Src/hist.c	28 Oct 2003 15:22:04 -0000
@@ -771,7 +771,7 @@
 	hwend = nohwe;
 	addtoline = nohw;
     } else {
-	chline = hptr = zcalloc(hlinesz = 64);
+	chline = hptr = zshcalloc(hlinesz = 64);
 	chwords = zalloc((chwordlen = 64) * sizeof(short));
 	hgetc = ihgetc;
 	hungetc = ihungetc;
@@ -933,7 +933,7 @@
     }
 
     if (histlinect < histsiz) {
-	he = (Histent)zcalloc(sizeof *he);
+	he = (Histent)zshcalloc(sizeof *he);
 	if (!hist_ring)
 	    hist_ring = he->up = he->down = he;
 	else {
Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.18.4.6
diff -u -r1.18.4.6 init.c
--- Src/init.c	23 Apr 2003 18:13:00 -0000	1.18.4.6
+++ Src/init.c	28 Oct 2003 15:22:04 -0000
@@ -325,7 +325,7 @@
     if(isset(SINGLECOMMAND))
 	opts[INTERACTIVE] &= 1;
     opts[INTERACTIVE] = !!opts[INTERACTIVE];
-    pparams = x = (char **) zcalloc((countlinknodes(paramlist) + 1) * sizeof(char *));
+    pparams = x = (char **) zshcalloc((countlinknodes(paramlist) + 1) * sizeof(char *));
 
     while ((*x++ = (char *)getlinknode(paramlist)));
     free(paramlist);
@@ -1191,9 +1191,9 @@
 	  break;
     } while (zsh_name);
 
-    /* Not zopenmax() here: it may return a number too big for zcalloc(). */
+    /* Not zopenmax() here: it may return a number too big for zshcalloc(). */
     fdtable_size = 256; /* This grows as necessary, see utils.c:movefd(). */
-    fdtable = zcalloc(fdtable_size);
+    fdtable = zshcalloc(fdtable_size);
 
     createoptiontable();
     emulate(zsh_name, 1);   /* initialises most options */
Index: Src/input.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/input.c,v
retrieving revision 1.4
diff -u -r1.4 input.c
--- Src/input.c	16 Jan 2001 13:44:20 -0000	1.4
+++ Src/input.c	28 Oct 2003 15:22:04 -0000
@@ -371,7 +371,7 @@
 	     * can't back up where we want to.  Instead, we just push it
 	     * onto the input stack as an extra character.
 	     */
-	    char *cback = (char *)zcalloc(2);
+	    char *cback = (char *)zshcalloc(2);
 	    cback[0] = (char) c;
 	    inpush(cback, INP_FREE|INP_CONT, NULL);
 	}
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.11.4.1
diff -u -r1.11.4.1 jobs.c
--- Src/jobs.c	8 Aug 2002 10:48:51 -0000	1.11.4.1
+++ Src/jobs.c	28 Oct 2003 15:22:04 -0000
@@ -815,7 +815,7 @@
     Process pn;
     struct timezone dummy_tz;
 
-    pn = (Process) zcalloc(sizeof *pn);
+    pn = (Process) zshcalloc(sizeof *pn);
     pn->pid = pid;
     if (text)
 	strcpy(pn->text, text);
Index: Src/mem.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mem.c,v
retrieving revision 1.5
diff -u -r1.5 mem.c
--- Src/mem.c	7 Mar 2001 12:58:41 -0000	1.5
+++ Src/mem.c	28 Oct 2003 15:22:04 -0000
@@ -32,7 +32,7 @@
 
 /*
 	There are two ways to allocate memory in zsh.  The first way is
-	to call zalloc/zcalloc, which call malloc/calloc directly.  It
+	to call zalloc/zshcalloc, which call malloc/calloc directly.  It
 	is legal to call realloc() or free() on memory allocated this way.
 	The second way is to call zhalloc/hcalloc, which allocates memory
 	from one of the memory pools on the heap stack.  Such memory pools 
@@ -498,7 +498,7 @@
 
 /**/
 mod_export void *
-zcalloc(size_t size)
+zshcalloc(size_t size)
 {
     void *ptr;
 
Index: Src/module.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/module.c,v
retrieving revision 1.9
diff -u -r1.9 module.c
--- Src/module.c	18 May 2001 15:23:09 -0000	1.9
+++ Src/module.c	28 Oct 2003 15:22:04 -0000
@@ -226,7 +226,7 @@
 int
 add_autobin(char *nam, char *module)
 {
-    Builtin bn = zcalloc(sizeof(*bn));
+    Builtin bn = zshcalloc(sizeof(*bn));
     bn->nam = ztrdup(nam);
     bn->optstr = ztrdup(module);
     return addbuiltin(bn);
@@ -770,7 +770,7 @@
 	    unqueue_signals();
 	    return 0;
 	}
-	m = zcalloc(sizeof(*m));
+	m = zshcalloc(sizeof(*m));
 	m->nam = ztrdup(name);
 	if (handle) {
 	    m->u.handle = handle;
@@ -912,7 +912,7 @@
      * *points* to a module with dependencies, of course.)
      */
     if (!(node = find_module(name, 1, &name))) {
-	m = zcalloc(sizeof(*m));
+	m = zshcalloc(sizeof(*m));
 	m->nam = ztrdup(name);
 	zaddlinknode(modules, m);
     } else
@@ -1094,7 +1094,7 @@
 		    }
 		    zsfree(m->u.alias);
 		} else {
-		    m = (Module) zcalloc(sizeof(*m));
+		    m = (Module) zshcalloc(sizeof(*m));
 		    m->nam = ztrdup(*args);
 		    m->flags = MOD_ALIAS;
 		    zaddlinknode(modules, m);
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.48.4.9
diff -u -r1.48.4.9 params.c
--- Src/params.c	12 May 2003 14:03:37 -0000	1.48.4.9
+++ Src/params.c	28 Oct 2003 15:22:04 -0000
@@ -318,7 +318,7 @@
 {
     /* Going into a real parameter, so always use permanent storage */
     Param pm = (Param)hn;
-    Param tpm = (Param) zcalloc(sizeof *tpm);
+    Param tpm = (Param) zshcalloc(sizeof *tpm);
     tpm->nam = ztrdup(pm->nam);
     copyparam(tpm, pm, 0);
     addhashnode(outtable, tpm->nam, tpm);
@@ -687,7 +687,7 @@
 	    pm->ct = 0;
 	    oldpm = pm->old;
 	} else {
-	    pm = (Param) zcalloc(sizeof *pm);
+	    pm = (Param) zshcalloc(sizeof *pm);
 	    if ((pm->old = oldpm)) {
 		/*
 		 * needed to avoid freeing oldpm, but we do take it
@@ -1753,7 +1753,7 @@
 	if (v->end <= n)
 	    ll += n - v->end + 1;
 
-	p = new = (char **) zcalloc(sizeof(char *) * (ll + 1));
+	p = new = (char **) zshcalloc(sizeof(char *) * (ll + 1));
 
 	for (i = 0; i < v->start; i++)
 	    *p++ = i < n ? ztrdup(*q++) : ztrdup("");
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.20.4.6
diff -u -r1.20.4.6 parse.c
--- Src/parse.c	6 Oct 2002 18:37:45 -0000	1.20.4.6
+++ Src/parse.c	28 Oct 2003 15:22:04 -0000
@@ -2064,7 +2064,7 @@
     r->len = p->len;
     r->npats = p->npats;
     pp = r->pats = (heap ? (Patprog *) hcalloc(r->len) :
-		    (Patprog *) zcalloc(r->len));
+		    (Patprog *) zshcalloc(r->len));
     r->prog = (Wordcode) (r->pats + r->npats);
     r->strs = ((char *) r->prog) + (p->strs - ((char *) p->prog));
     memcpy(r->prog, p->prog, r->len - (p->npats * sizeof(Patprog)));
@@ -3161,7 +3161,7 @@
 
     for (n = firstfdhead(h), e = (FDHead) (h + fdheaderlen(h)); n < e;
 	 n = nextfdhead(n)) {
-	shf = (Shfunc) zcalloc(sizeof *shf);
+	shf = (Shfunc) zshcalloc(sizeof *shf);
 	shf->flags = on;
 	shf->funcdef = mkautofn(shf);
 	shfunctab->addnode(shfunctab, ztrdup(fdname(n) + fdhtail(n)), shf);
Index: Src/pattern.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/pattern.c,v
retrieving revision 1.9.4.1
diff -u -r1.9.4.1 pattern.c
--- Src/pattern.c	3 Jun 2003 18:03:38 -0000	1.9.4.1
+++ Src/pattern.c	28 Oct 2003 15:22:04 -0000
@@ -1430,9 +1430,9 @@
 		char **matcharr, **mbeginarr, **mendarr;
 		char numbuf[DIGBUFSIZE];
 
-		matcharr = zcalloc(palen*sizeof(char *));
-		mbeginarr = zcalloc(palen*sizeof(char *));
-		mendarr = zcalloc(palen*sizeof(char *));
+		matcharr = zshcalloc(palen*sizeof(char *));
+		mbeginarr = zshcalloc(palen*sizeof(char *));
+		mendarr = zshcalloc(palen*sizeof(char *));
 
 		sp = patbeginp;
 		ep = patendp;
@@ -1786,7 +1786,7 @@
 			oldsyncstr = syncstrp->p;
 			if (!patinlen)
 			    patinlen = strlen(patinstart)+1;
-			syncstrp->p = (unsigned char *)zcalloc(patinlen);
+			syncstrp->p = (unsigned char *)zshcalloc(patinlen);
 			while ((ret = patmatch(P_OPERAND(scan)))) {
 			    unsigned char *syncpt;
 			    char savchar, *testptr;
@@ -1909,7 +1909,7 @@
 			    if (!ptrp->p) {
 				if (!patinlen)
 				    patinlen = strlen((char *)patinstart)+1;
-				ptrp->p = (unsigned char *)zcalloc(patinlen);
+				ptrp->p = (unsigned char *)zshcalloc(patinlen);
 				pfree = 1;
 			    }
 			    ptr = ptrp->p + (patinput - patinstart);
Index: Src/prompt.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v
retrieving revision 1.5.4.4
diff -u -r1.5.4.4 prompt.c
--- Src/prompt.c	26 Jun 2001 06:01:47 -0000	1.5.4.4
+++ Src/prompt.c	28 Oct 2003 15:22:04 -0000
@@ -171,7 +171,7 @@
     rstring = rs;
     Rstring = Rs;
     fm = s;
-    bp = bufline = buf = zcalloc(bufspc = 256);
+    bp = bufline = buf = zshcalloc(bufspc = 256);
     bp1 = NULL;
     trunclen = 0;
     putpromptchar(1, '\0');
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.30.4.7
diff -u -r1.30.4.7 utils.c
--- Src/utils.c	1 Aug 2003 16:30:23 -0000	1.30.4.7
+++ Src/utils.c	28 Oct 2003 15:22:04 -0000
@@ -293,7 +293,7 @@
     int t0;
 
     if (!*s)
-	return (char **) zcalloc(sizeof(char **));
+	return (char **) zshcalloc(sizeof(char **));
 
     for (t = s, t0 = 0; *t; t++)
 	if (*t == '/')
@@ -541,7 +541,7 @@
     }
 
     /* add the name */
-    nd = (Nameddir) zcalloc(sizeof *nd);
+    nd = (Nameddir) zshcalloc(sizeof *nd);
     nd->flags = flags;
     nd->dir = ztrdup(t);
     /* The variables PWD and OLDPWD are not to be displayed as ~PWD etc. */
@@ -1771,7 +1771,7 @@
 	len += strlen(*s) + 1;
     if (!len)
 	return heap? "" : ztrdup("");
-    ptr = ret = (heap ? (char *) hcalloc(len) : (char *) zcalloc(len));
+    ptr = ret = (heap ? (char *) hcalloc(len) : (char *) zshcalloc(len));
     for (s = arr; *s; s++) {
 	strucpy(&ptr, *s);
 	if (delim)
@@ -1841,7 +1841,7 @@
     int l = sizeof(*ret) * (wordcount(s, NULL, -!allownull) + 1);
     char *(*dup)(const char *) = (heap ? dupstring : ztrdup);
 
-    ptr = ret = (heap ? (char **) hcalloc(l) : (char **) zcalloc(l));
+    ptr = ret = (heap ? (char **) hcalloc(l) : (char **) zshcalloc(l));
 
     if (quote) {
 	/*
@@ -1868,7 +1868,7 @@
 	findsep(&s, NULL, quote);
 	if (s > t || allownull) {
 	    *ptr = (heap ? (char *) hcalloc((s - t) + 1) :
-		    (char *) zcalloc((s - t) + 1));
+		    (char *) zshcalloc((s - t) + 1));
 	    ztrncpy(*ptr++, t, s - t);
 	} else
 	    *ptr++ = dup(nulstring);
@@ -2040,7 +2040,7 @@
     }
     sl = strlen(sep);
     for (t = s, l = 1 - sl; *t; l += strlen(*t) + sl, t++);
-    r = p = (heap ? (char *) hcalloc(l) : (char *) zcalloc(l));
+    r = p = (heap ? (char *) hcalloc(l) : (char *) zshcalloc(l));
     t = s;
     while (*t) {
 	strucpy(&p, *t);
@@ -2064,13 +2064,13 @@
     sl = strlen(sep);
     n = wordcount(s, sep, 1);
     r = p = (heap ? (char **) hcalloc((n + 1) * sizeof(char *)) :
-	     (char **) zcalloc((n + 1) * sizeof(char *)));
+	     (char **) zshcalloc((n + 1) * sizeof(char *)));
 
     for (t = s; n--;) {
 	tt = t;
 	findsep(&t, sep, 0);
 	*p = (heap ? (char *) hcalloc(t - tt + 1) :
-	      (char *) zcalloc(t - tt + 1));
+	      (char *) zshcalloc(t - tt + 1));
 	strncpy(*p, tt, t - tt);
 	(*p)[t - tt] = '\0';
 	p++;
Index: Src/Builtins/sched.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/sched.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 sched.c
--- Src/Builtins/sched.c	23 Feb 2000 15:18:47 -0000	1.1.1.7
+++ Src/Builtins/sched.c	28 Oct 2003 15:22:04 -0000
@@ -141,7 +141,7 @@
     }
     /* The time has been calculated; now add the new entry to the linked list
     of scheduled commands. */
-    sch = (struct schedcmd *) zcalloc(sizeof *sch);
+    sch = (struct schedcmd *) zshcalloc(sizeof *sch);
     sch->time = t;
     sch->cmd = zjoin(argv, ' ', 0);
     sch->next = NULL;
Index: Src/Modules/parameter.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/parameter.c,v
retrieving revision 1.20.4.2
diff -u -r1.20.4.2 parameter.c
--- Src/Modules/parameter.c	7 Mar 2003 12:31:44 -0000	1.20.4.2
+++ Src/Modules/parameter.c	28 Oct 2003 15:22:04 -0000
@@ -200,7 +200,7 @@
 	zwarn("restricted: %s", value, 0);
 	zsfree(value);
     } else {
-	Cmdnam cn = zcalloc(sizeof(*cn));
+	Cmdnam cn = zshcalloc(sizeof(*cn));
 
 	cn->flags = HASHED;
 	cn->u.cmd = value;
@@ -231,7 +231,7 @@
 
     for (i = 0; i < ht->hsize; i++)
 	for (hn = ht->nodes[i]; hn; hn = hn->next) {
-	    Cmdnam cn = zcalloc(sizeof(*cn));
+	    Cmdnam cn = zshcalloc(sizeof(*cn));
 	    struct value v;
 
 	    v.isarr = v.inv = v.start = 0;
@@ -1417,7 +1417,7 @@
     if (!value)
 	zwarn("invalid value: ''", NULL, 0);
     else {
-	Nameddir nd = (Nameddir) zcalloc(sizeof(*nd));
+	Nameddir nd = (Nameddir) zshcalloc(sizeof(*nd));
 
 	nd->flags = 0;
 	nd->dir = value;
@@ -1466,7 +1466,7 @@
 	    if (!(val = getstrvalue(&v)))
 		zwarn("invalid value: ''", NULL, 0);
 	    else {
-		Nameddir nd = (Nameddir) zcalloc(sizeof(*nd));
+		Nameddir nd = (Nameddir) zshcalloc(sizeof(*nd));
 
 		nd->flags = 0;
 		nd->dir = ztrdup(val);
Index: Src/Modules/stat.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/stat.c,v
retrieving revision 1.4
diff -u -r1.4 stat.c
--- Src/Modules/stat.c	11 May 2001 12:59:50 -0000	1.4
+++ Src/Modules/stat.c	28 Oct 2003 15:22:04 -0000
@@ -518,7 +518,7 @@
 	arrsize = (flags & STF_PICK) ? 1 : ST_COUNT;
 	if (flags & STF_FILE)
 	    arrsize++;
-	hashptr = hash = (char **)zcalloc((arrsize+1)*2*sizeof(char *));
+	hashptr = hash = (char **)zshcalloc((arrsize+1)*2*sizeof(char *));
     }
 
     if (arrnam) {
@@ -526,7 +526,7 @@
 	if (flags & STF_FILE)
 	    arrsize++;
 	arrsize *= nargs;
-	arrptr = array = (char **)zcalloc((arrsize+1)*sizeof(char *));
+	arrptr = array = (char **)zshcalloc((arrsize+1)*sizeof(char *));
     }
 
     for (; ops['f'] || *args; args++) {
Index: Src/Modules/zftp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.c,v
retrieving revision 1.12.4.2
diff -u -r1.12.4.2 zftp.c
--- Src/Modules/zftp.c	25 Apr 2002 14:48:21 -0000	1.12.4.2
+++ Src/Modules/zftp.c	28 Oct 2003 15:22:04 -0000
@@ -2222,7 +2222,7 @@
 	return 0;
     }
     len = arrlen(args);
-    newarr = (char **)zcalloc((len+1)*sizeof(char *));
+    newarr = (char **)zshcalloc((len+1)*sizeof(char *));
     for (aptr = args, i = 0; *aptr && !errflag; aptr++, i++) {
 	char *str;
 	if (**aptr == '?')
@@ -2935,10 +2935,10 @@
     }
 
     if (!nptr) {
-	zfsess = (Zftp_session) zcalloc(sizeof(struct zftp_session));
+	zfsess = (Zftp_session) zshcalloc(sizeof(struct zftp_session));
 	zfsess->name = ztrdup(nm);
 	zfsess->cfd = zfsess->dfd = -1;
-	zfsess->params = (char **) zcalloc(sizeof(zfparams));
+	zfsess->params = (char **) zshcalloc(sizeof(zfparams));
 	zaddlinknode(zfsessions, zfsess);
 
 	zfsesscnt++;
Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.45.4.3
diff -u -r1.45.4.3 compcore.c
--- Src/Zle/compcore.c	10 Feb 2002 17:24:06 -0000	1.45.4.3
+++ Src/Zle/compcore.c	28 Oct 2003 15:22:04 -0000
@@ -616,7 +616,7 @@
 		untokenize(*q = ztrdup(*p));
 	    *q = NULL;
 	} else
-	    compwords = (char **) zcalloc(sizeof(char *));
+	    compwords = (char **) zshcalloc(sizeof(char *));
 
 	compparameter = ztrdup(compparameter);
 	compredirect = ztrdup(compredirect);
@@ -2706,7 +2706,7 @@
 {
     Cmatch r;
 
-    r = (Cmatch) zcalloc(sizeof(struct cmatch));
+    r = (Cmatch) zshcalloc(sizeof(struct cmatch));
 
     r->str = ztrdup(m->str);
     r->ipre = ztrdup(m->ipre);
@@ -2803,7 +2803,7 @@
 	    if (g->mcount > 1)
 		diffmatches = 1;
 
-	    n = (Cmgroup) zcalloc(sizeof(struct cmgroup));
+	    n = (Cmgroup) zshcalloc(sizeof(struct cmgroup));
 
 	    if (g->perm) {
 		g->perm->next = NULL;
@@ -2821,7 +2821,7 @@
 	    n->num = gn++;
 	    n->flags = g->flags;
 	    n->mcount = g->mcount;
-	    n->matches = p = (Cmatch *) zcalloc((n->mcount + 1) * sizeof(Cmatch));
+	    n->matches = p = (Cmatch *) zshcalloc((n->mcount + 1) * sizeof(Cmatch));
 	    n->name = ztrdup(g->name);
 	    for (q = g->matches; *q; q++, p++)
 		*p = dupmatch(*q, nbrbeg, nbrend);
@@ -2835,9 +2835,9 @@
 		n->ylist = NULL;
 
 	    if ((n->ecount = g->ecount)) {
-		n->expls = ep = (Cexpl *) zcalloc((n->ecount + 1) * sizeof(Cexpl));
+		n->expls = ep = (Cexpl *) zshcalloc((n->ecount + 1) * sizeof(Cexpl));
 		for (eq = g->expls; (o = *eq); eq++, ep++) {
-		    *ep = e = (Cexpl) zcalloc(sizeof(struct cexpl));
+		    *ep = e = (Cexpl) zshcalloc(sizeof(struct cexpl));
 		    e->count = (fi ? o->fcount : o->count);
 		    e->fcount = 0;
 		    e->str = ztrdup(o->str);
Index: Src/Zle/compctl.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compctl.c,v
retrieving revision 1.10.4.1
diff -u -r1.10.4.1 compctl.c
--- Src/Zle/compctl.c	23 Nov 2001 19:34:54 -0000	1.10.4.1
+++ Src/Zle/compctl.c	28 Oct 2003 15:22:05 -0000
@@ -242,7 +242,7 @@
 	if (ops['A'] && !ops['e']) {
 	    /* the -A option means that one array is specified, instead of
 	    many parameters */
-	    char **p, **b = (char **)zcalloc((clwnum + 1) * sizeof(char *));
+	    char **p, **b = (char **)zshcalloc((clwnum + 1) * sizeof(char *));
 
 	    for (i = 0, p = b; i < clwnum; p++, i++)
 		*p = ztrdup(clwords[i]);
@@ -893,7 +893,7 @@
 		    cc->xor = &cc_default;
 	    } else {
 		/* more flags follow:  prepare to loop again */
-		cc->xor = (Compctl) zcalloc(sizeof(*cc));
+		cc->xor = (Compctl) zshcalloc(sizeof(*cc));
 		cc = cc->xor;
 		memset((void *)&cct, 0, sizeof(cct));
 		cct.mask2 = CC_CCCONT;
@@ -930,7 +930,7 @@
 	/* o keeps track of or's, m remembers the starting condition,
 	 * c is the current condition being parsed
 	 */
-	o = m = c = (Compcond) zcalloc(sizeof(*c));
+	o = m = c = (Compcond) zshcalloc(sizeof(*c));
 	/* Loop over each condition:  something like 's[...][...], p[...]' */
 	for (t = *argv; *t;) {
 	    while (*t == ' ')
@@ -1021,20 +1021,20 @@
 	    /* Allocate space for all the arguments of the conditions */
 	    if (c->type == CCT_POS ||
 		c->type == CCT_NUMWORDS) {
-		c->u.r.a = (int *)zcalloc(n * sizeof(int));
-		c->u.r.b = (int *)zcalloc(n * sizeof(int));
+		c->u.r.a = (int *)zshcalloc(n * sizeof(int));
+		c->u.r.b = (int *)zshcalloc(n * sizeof(int));
 	    } else if (c->type == CCT_CURSUF ||
 		       c->type == CCT_CURPRE ||
 		       c->type == CCT_QUOTE)
-		c->u.s.s = (char **)zcalloc(n * sizeof(char *));
+		c->u.s.s = (char **)zshcalloc(n * sizeof(char *));
 
 	    else if (c->type == CCT_RANGESTR ||
 		     c->type == CCT_RANGEPAT) {
-		c->u.l.a = (char **)zcalloc(n * sizeof(char *));
-		c->u.l.b = (char **)zcalloc(n * sizeof(char *));
+		c->u.l.a = (char **)zshcalloc(n * sizeof(char *));
+		c->u.l.b = (char **)zshcalloc(n * sizeof(char *));
 	    } else {
-		c->u.s.p = (int *)zcalloc(n * sizeof(int));
-		c->u.s.s = (char **)zcalloc(n * sizeof(char *));
+		c->u.s.p = (int *)zshcalloc(n * sizeof(int));
+		c->u.s.s = (char **)zshcalloc(n * sizeof(char *));
 	    }
 	    /* Now loop over the actual arguments */
 	    for (l = 0; *t == '['; l++, t++) {
@@ -1137,17 +1137,17 @@
 		t++;
 	    if (*t == ',') {
 		/* Another condition to `or' */
-		o->or = c = (Compcond) zcalloc(sizeof(*c));
+		o->or = c = (Compcond) zshcalloc(sizeof(*c));
 		o = c;
 		t++;
 	    } else if (*t) {
 		/* Another condition to `and' */
-		c->and = (Compcond) zcalloc(sizeof(*c));
+		c->and = (Compcond) zshcalloc(sizeof(*c));
 		c = c->and;
 	    }
 	}
 	/* Assign condition to current compctl */
-	*next = (Compctl) zcalloc(sizeof(*cc));
+	*next = (Compctl) zshcalloc(sizeof(*cc));
 	(*next)->cond = m;
 	argv++;
 	/* End of the condition; get the flags that go with it. */
@@ -1271,7 +1271,7 @@
      */
     Compctl c2;
 
-    c2 = (Compctl) zcalloc(sizeof *cc);
+    c2 = (Compctl) zshcalloc(sizeof *cc);
     c2->xor = cc->xor;
     c2->ext = cc->ext;
     c2->refc = 1;
@@ -1587,7 +1587,7 @@
 	if ((ret = get_gmatcher(name, argv)))
 	    return ret - 1;
 
-	cc = (Compctl) zcalloc(sizeof(*cc));
+	cc = (Compctl) zshcalloc(sizeof(*cc));
 	if (get_compctl(name, &argv, cc, 1, 0, 0)) {
 	    freecompctl(cc);
 	    return 1;
Index: Src/Zle/complete.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.c,v
retrieving revision 1.16.4.2
diff -u -r1.16.4.2 complete.c
--- Src/Zle/complete.c	24 Aug 2001 12:14:41 -0000	1.16.4.2
+++ Src/Zle/complete.c	28 Oct 2003 15:22:05 -0000
@@ -686,7 +686,7 @@
 	    e = wl;
 
 	i = e - b + 1;
-	p = (char **) zcalloc((i + 1) * sizeof(char *));
+	p = (char **) zshcalloc((i + 1) * sizeof(char *));
 
 	for (q = p, pp = compwords + b; i; i--, q++, pp++)
 	    *q = ztrdup(*pp);
@@ -1158,7 +1158,7 @@
 		*((char **) pm->u.data) = ztrdup("");
 	    } else if (PM_TYPE(pm->flags) == PM_ARRAY) {
 		freearray(*((char ***) pm->u.data));
-		*((char ***) pm->u.data) = zcalloc(sizeof(char *));
+		*((char ***) pm->u.data) = zshcalloc(sizeof(char *));
 	    } else if (PM_TYPE(pm->flags) == PM_HASHED) {
 		deleteparamtable(pm->u.hash);
 		pm->u.hash = NULL;
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.58.4.6
diff -u -r1.58.4.6 computil.c
--- Src/Zle/computil.c	23 Apr 2003 18:52:50 -0000	1.58.4.6
+++ Src/Zle/computil.c	28 Oct 2003 15:22:05 -0000
@@ -124,7 +124,7 @@
     cd_state.showd = disp;
 
     while (*args) {
-	*setp = set = (Cdset) zcalloc(sizeof(*set));
+	*setp = set = (Cdset) zshcalloc(sizeof(*set));
 	setp = &(set->next);
 
 	if (!(ap = get_user_var(*args))) {
Index: Src/Zle/zle_keymap.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_keymap.c,v
retrieving revision 1.7
diff -u -r1.7 zle_keymap.c
--- Src/Zle/zle_keymap.c	19 Apr 2001 19:43:45 -0000	1.7
+++ Src/Zle/zle_keymap.c	28 Oct 2003 15:22:05 -0000
@@ -156,7 +156,7 @@
 static KeymapName
 makekeymapnamnode(Keymap keymap)
 {
-    KeymapName kmn = (KeymapName) zcalloc(sizeof(*kmn));
+    KeymapName kmn = (KeymapName) zshcalloc(sizeof(*kmn));
 
     kmn->keymap = keymap;
     return kmn;
@@ -201,7 +201,7 @@
 static Key
 makekeynode(Thingy t, char *str)
 {
-    Key k = (Key) zcalloc(sizeof(*k));
+    Key k = (Key) zshcalloc(sizeof(*k));
 
     k->bind = t;
     k->str = str;
@@ -230,7 +230,7 @@
 mod_export Keymap
 newkeymap(Keymap tocopy, char *kmname)
 {
-    Keymap km = zcalloc(sizeof(*km));
+    Keymap km = zshcalloc(sizeof(*km));
     int i;
 
     km->rc = 0;
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.18
diff -u -r1.18 zle_main.c
--- Src/Zle/zle_main.c	17 May 2001 15:56:13 -0000	1.18
+++ Src/Zle/zle_main.c	28 Oct 2003 15:22:05 -0000
@@ -1141,7 +1141,7 @@
 
     incompfunc = incompctlfunc = hascompmod = 0;
 
-    clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *));
+    clwords = (char **) zshcalloc((clwsize = 16) * sizeof(char *));
 
     return 0;
 }
Index: Src/Zle/zle_refresh.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
retrieving revision 1.1.1.19.4.3
diff -u -r1.1.1.19.4.3 zle_refresh.c
--- Src/Zle/zle_refresh.c	12 Apr 2002 23:24:21 -0000	1.1.1.19.4.3
+++ Src/Zle/zle_refresh.c	28 Oct 2003 15:22:05 -0000
@@ -133,8 +133,8 @@
 	    free(nbuf);
 	    free(obuf);
 	}
-	nbuf = (char **)zcalloc((winh + 1) * sizeof(char *));
-	obuf = (char **)zcalloc((winh + 1) * sizeof(char *));
+	nbuf = (char **)zshcalloc((winh + 1) * sizeof(char *));
+	obuf = (char **)zshcalloc((winh + 1) * sizeof(char *));
 	nbuf[0] = (char *)zalloc(winw + 2);
 	obuf[0] = (char *)zalloc(winw + 2);
 
Index: Src/Zle/zle_thingy.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_thingy.c,v
retrieving revision 1.3
diff -u -r1.3 zle_thingy.c
--- Src/Zle/zle_thingy.c	11 Nov 2000 19:50:29 -0000	1.3
+++ Src/Zle/zle_thingy.c	28 Oct 2003 15:22:05 -0000
@@ -107,7 +107,7 @@
 static Thingy
 makethingynode(void)
 {
-    Thingy t = (Thingy) zcalloc(sizeof(*t));
+    Thingy t = (Thingy) zshcalloc(sizeof(*t));
 
     t->flags = DISABLED;
     return t;

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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