summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-10-29 19:17:30 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-10-29 19:17:30 +0000
commit815bc92148939ce369585c59d3af730f69833844 (patch)
tree2787fe59d0c8b27c6a9cf18e65784cdbd925c9b1
parent026631ab818995ad480a9ea3e5a7ec243c645db1 (diff)
downloadzsh-815bc92148939ce369585c59d3af730f69833844.tar.gz
zsh-815bc92148939ce369585c59d3af730f69833844.zip
a la 19209: zcalloc -> zshcalloc
-rw-r--r--Src/Builtins/sched.c2
-rw-r--r--Src/Modules/parameter.c8
-rw-r--r--Src/Modules/stat.c4
-rw-r--r--Src/Modules/tcp.c2
-rw-r--r--Src/Modules/zftp.c6
-rw-r--r--Src/Zle/compcore.c14
-rw-r--r--Src/Zle/compctl.c30
-rw-r--r--Src/Zle/complete.c4
-rw-r--r--Src/Zle/computil.c2
-rw-r--r--Src/Zle/zle_keymap.c6
-rw-r--r--Src/Zle/zle_main.c2
-rw-r--r--Src/Zle/zle_params.c4
-rw-r--r--Src/Zle/zle_refresh.c4
-rw-r--r--Src/Zle/zle_thingy.c2
-rw-r--r--Src/Zle/zle_utils.c2
-rw-r--r--Src/builtin.c8
-rw-r--r--Src/exec.c6
-rw-r--r--Src/hashtable.c14
-rw-r--r--Src/hist.c4
-rw-r--r--Src/init.c4
-rw-r--r--Src/input.c2
-rw-r--r--Src/jobs.c2
-rw-r--r--Src/mem.c4
-rw-r--r--Src/module.c8
-rw-r--r--Src/params.c6
-rw-r--r--Src/parse.c4
-rw-r--r--Src/pattern.c10
-rw-r--r--Src/prompt.c2
-rw-r--r--Src/utils.c16
29 files changed, 91 insertions, 91 deletions
diff --git a/Src/Builtins/sched.c b/Src/Builtins/sched.c
index 05e3cfb3f..8bc9b2c8a 100644
--- a/Src/Builtins/sched.c
+++ b/Src/Builtins/sched.c
@@ -141,7 +141,7 @@ bin_sched(char *nam, char **argv, Options ops, int func)
}
/* 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;
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 8e70e111d..eb03b9d7d 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -202,7 +202,7 @@ setpmcommand(Param pm, char *value)
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;
@@ -233,7 +233,7 @@ setpmcommands(Param pm, HashTable ht)
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;
@@ -1419,7 +1419,7 @@ setpmnameddir(Param pm, char *value)
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;
@@ -1468,7 +1468,7 @@ setpmnameddirs(Param pm, HashTable ht)
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);
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index 5b5479711..162612ee9 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -518,7 +518,7 @@ bin_stat(char *name, char **args, Options ops, int func)
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 @@ bin_stat(char *name, char **args, Options ops, int func)
if (flags & STF_FILE)
arrsize++;
arrsize *= nargs;
- arrptr = array = (char **)zcalloc((arrsize+1)*sizeof(char *));
+ arrptr = array = (char **)zshcalloc((arrsize+1)*sizeof(char *));
}
for (; OPT_ISSET(ops,'f') || *args; args++) {
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index 2f3d0424d..8e42ead55 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -216,7 +216,7 @@ zts_alloc(int ztflags)
{
Tcp_session sess;
- sess = (Tcp_session)zcalloc(sizeof(struct tcp_session));
+ sess = (Tcp_session)zshcalloc(sizeof(struct tcp_session));
if (!sess) return NULL;
sess->fd=-1;
sess->flags=ztflags;
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index 918061e42..d79981645 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -2042,7 +2042,7 @@ zftp_params(char *name, char **args, int flags)
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 == '?')
@@ -2764,10 +2764,10 @@ newsession(char *nm)
}
if (!nptr) {
- zfsess = (Zftp_session) zcalloc(sizeof(struct zftp_session));
+ zfsess = (Zftp_session) zshcalloc(sizeof(struct zftp_session));
zfsess->name = ztrdup(nm);
zfsess->dfd = -1;
- zfsess->params = (char **) zcalloc(sizeof(zfparams));
+ zfsess->params = (char **) zshcalloc(sizeof(zfparams));
zaddlinknode(zfsessions, zfsess);
zfsesscnt++;
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 5b26ff883..22e5a2436 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -618,14 +618,14 @@ callcompfunc(char *s, char *fn)
untokenize(*q = ztrdup(*p));
*q = NULL;
} else
- compwords = (char **) zcalloc(sizeof(char *));
+ compwords = (char **) zshcalloc(sizeof(char *));
if (compredirs)
freearray(compredirs);
if (rdstrs)
compredirs = bld_list_array(rdstrs);
else
- compredirs = (char **) zcalloc(sizeof(char *));
+ compredirs = (char **) zshcalloc(sizeof(char *));
compparameter = ztrdup(compparameter);
compredirect = ztrdup(compredirect);
@@ -2822,7 +2822,7 @@ dupmatch(Cmatch m, int nbeg, int nend)
{
Cmatch r;
- r = (Cmatch) zcalloc(sizeof(struct cmatch));
+ r = (Cmatch) zshcalloc(sizeof(struct cmatch));
r->str = ztrdup(m->str);
r->orig = ztrdup(m->orig);
@@ -2922,7 +2922,7 @@ permmatches(int last)
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;
@@ -2940,7 +2940,7 @@ permmatches(int last)
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);
@@ -2954,9 +2954,9 @@ permmatches(int last)
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->always = o->always;
e->fcount = 0;
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 69f742731..f55deff5c 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -242,7 +242,7 @@ compctlread(char *name, char **args, Options ops, char *reply)
if (OPT_ISSET(ops,'A') && !OPT_ISSET(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 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
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 @@ get_xcompctl(char *name, char ***av, Compctl cc, int isdef)
/* 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 @@ get_xcompctl(char *name, char ***av, Compctl cc, int isdef)
/* 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 @@ get_xcompctl(char *name, char ***av, Compctl cc, int isdef)
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 @@ cc_reassign(Compctl cc)
*/
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 @@ bin_compctl(char *name, char **argv, Options ops, int func)
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;
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 713ce7f9e..b325b8536 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -707,7 +707,7 @@ restrict_range(int b, int e)
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);
@@ -1180,7 +1180,7 @@ compunsetfn(Param pm, int exp)
*((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;
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 795b2ba50..178101b61 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -458,7 +458,7 @@ cd_init(char *nam, char *hide, char *mlen, char *sep,
grp = 1;
}
while (*args) {
- *setp = set = (Cdset) zcalloc(sizeof(*set));
+ *setp = set = (Cdset) zshcalloc(sizeof(*set));
setp = &(set->next);
*setp = NULL;
set->opts = NULL;
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 58e5e2175..9f3b9dfd4 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -156,7 +156,7 @@ createkeymapnamtab(void)
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 @@ newkeytab(char *kmname)
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 @@ static HashTable copyto;
mod_export Keymap
newkeymap(Keymap tocopy, char *kmname)
{
- Keymap km = zcalloc(sizeof(*km));
+ Keymap km = zshcalloc(sizeof(*km));
int i;
km->rc = 0;
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 1c8b590a8..7309e3763 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1386,7 +1386,7 @@ setup_(Module m)
incompfunc = incompctlfunc = hascompmod = 0;
hascompwidgets = 0;
- clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *));
+ clwords = (char **) zshcalloc((clwsize = 16) * sizeof(char *));
return 0;
}
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 45df2fa8e..a9fd93450 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -414,7 +414,7 @@ set_killring(Param pm, char **x)
*/
int kpos = 0;
kringsize = arrlen(x);
- kring = (Cutbuffer)zcalloc(kringsize * sizeof(struct cutbuffer));
+ kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
for (p = x; *p; p++) {
int len = strlen(*p);
kptr = kring + kpos;
@@ -443,7 +443,7 @@ get_killring(Param pm)
/* Supposed to work even if kring is NULL */
if (!kring) {
kringsize = KRINGCTDEF;
- kring = (Cutbuffer)zcalloc(kringsize * sizeof(struct cutbuffer));
+ kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
}
p = ret = (char **)zhalloc((kringsize+1) * sizeof(char *));
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 1d745d4f7..86564eb74 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -148,8 +148,8 @@ resetvideo(void)
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);
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 503060d7b..71eab02e7 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -107,7 +107,7 @@ scanemptythingies(HashNode hn, int flags)
static Thingy
makethingynode(void)
{
- Thingy t = (Thingy) zcalloc(sizeof(*t));
+ Thingy t = (Thingy) zshcalloc(sizeof(*t));
t->flags = DISABLED;
return t;
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 28f5647bd..53fef20e5 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -170,7 +170,7 @@ cut(int i, int ct, int dir)
Cutbuffer kptr;
if (!kring) {
kringsize = KRINGCTDEF;
- kring = (Cutbuffer)zcalloc(kringsize * sizeof(struct cutbuffer));
+ kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
} else
kringnum = (kringnum + 1) % kringsize;
kptr = kring + kringnum;
diff --git a/Src/builtin.c b/Src/builtin.c
index 4df9ea51e..3f6295639 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2411,7 +2411,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
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;
@@ -2483,7 +2483,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
} 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);
@@ -2897,11 +2897,11 @@ bin_hash(char *name, char **argv, Options ops, int func)
/* The argument is of the form foo=bar, *
* so define an entry for the table. */
if(OPT_ISSET(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);
}
diff --git a/Src/exec.c b/Src/exec.c
index daf4ce36d..0b6948c6e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -728,7 +728,7 @@ hashcmd(char *arg0, char **pp)
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);
@@ -3486,7 +3486,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
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;
@@ -3496,7 +3496,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
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);
diff --git a/Src/hashtable.c b/Src/hashtable.c
index f23a68fc2..7057c9a7e 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -96,7 +96,7 @@ newhashtable(int size, char const *name, PrintTableStats printinfo)
{
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 @@ newhashtable(int size, char const *name, PrintTableStats printinfo)
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 @@ expandhashtable(HashTable ht)
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 @@ resizehashtable(HashTable ht, int newsize)
* 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 @@ hashdir(char **dirp)
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 @@ hashdir(char **dirp)
(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);
@@ -1069,7 +1069,7 @@ createaliasnode(char *txt, int flags)
{
Alias al;
- al = (Alias) zcalloc(sizeof *al);
+ al = (Alias) zshcalloc(sizeof *al);
al->flags = flags;
al->text = txt;
al->inuse = 0;
diff --git a/Src/hist.c b/Src/hist.c
index a25354f07..0e0c4be98 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -773,7 +773,7 @@ hbegin(int dohist)
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;
@@ -966,7 +966,7 @@ prepnexthistent(void)
}
if (histlinect < histsiz) {
- he = (Histent)zcalloc(sizeof *he);
+ he = (Histent)zshcalloc(sizeof *he);
if (!hist_ring)
hist_ring = he->up = he->down = he;
else {
diff --git a/Src/init.c b/Src/init.c
index 51cbe0d3a..0befe5e9b 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -323,7 +323,7 @@ parseargs(char **argv)
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);
@@ -1242,7 +1242,7 @@ zsh_main(int argc, char **argv)
} while (zsh_name);
fdtable_size = zopenmax();
- fdtable = zcalloc(fdtable_size);
+ fdtable = zshcalloc(fdtable_size);
createoptiontable();
emulate(zsh_name, 1); /* initialises most options */
diff --git a/Src/input.c b/Src/input.c
index 08ad4eb87..3867474b8 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -380,7 +380,7 @@ inungetc(int c)
* 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);
}
diff --git a/Src/jobs.c b/Src/jobs.c
index f7c24ab3f..5599d549f 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -882,7 +882,7 @@ addproc(pid_t pid, char *text, int aux)
Process pn, *pnlist;
struct timezone dummy_tz;
- pn = (Process) zcalloc(sizeof *pn);
+ pn = (Process) zshcalloc(sizeof *pn);
pn->pid = pid;
if (text)
strcpy(pn->text, text);
diff --git a/Src/mem.c b/Src/mem.c
index 1d60fc42a..027c35d9c 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -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 @@ zalloc(size_t size)
/**/
mod_export void *
-zcalloc(size_t size)
+zshcalloc(size_t size)
{
void *ptr;
diff --git a/Src/module.c b/Src/module.c
index 2c2e9e0f0..1df8a03b6 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -226,7 +226,7 @@ mod_export LinkList modules;
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 @@ load_module(char const *name)
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 @@ add_dep(const char *name, char *from)
* *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
@@ -1099,7 +1099,7 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
}
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);
diff --git a/Src/params.c b/Src/params.c
index 079378180..c77b23566 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -332,7 +332,7 @@ scancopyparams(HashNode hn, int flags)
{
/* 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);
@@ -701,7 +701,7 @@ createparam(char *name, int flags)
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
@@ -1770,7 +1770,7 @@ setarrvalue(Value v, char **val)
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("");
diff --git a/Src/parse.c b/Src/parse.c
index d7aaa9f63..b1c1d1594 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2097,7 +2097,7 @@ dupeprog(Eprog p, int heap)
*/
r->nref = heap ? -1 : 1;
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)));
@@ -3240,7 +3240,7 @@ dump_autoload(char *nam, char *file, int on, Options ops, int func)
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);
diff --git a/Src/pattern.c b/Src/pattern.c
index 89c07b52f..71c6b3410 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -1447,9 +1447,9 @@ pattryrefs(Patprog prog, char *string, int *nump, int *begp, int *endp)
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;
@@ -1803,7 +1803,7 @@ patmatch(Upat prog)
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;
@@ -1926,7 +1926,7 @@ patmatch(Upat prog)
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);
diff --git a/Src/prompt.c b/Src/prompt.c
index dc31eddb6..1b847f879 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -175,7 +175,7 @@ promptexpand(char *s, int ns, char *rs, char *Rs)
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');
diff --git a/Src/utils.c b/Src/utils.c
index 536fe13e0..6b550a2cb 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -304,7 +304,7 @@ slashsplit(char *s)
int t0;
if (!*s)
- return (char **) zcalloc(sizeof(char **));
+ return (char **) zshcalloc(sizeof(char **));
for (t = s, t0 = 0; *t; t++)
if (*t == '/')
@@ -552,7 +552,7 @@ adduserdir(char *s, char *t, int flags, int always)
}
/* 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. */
@@ -1846,7 +1846,7 @@ zjoin(char **arr, int delim, int heap)
len += strlen(*s) + 1 + (imeta(delim) ? 1 : 0);
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) {
@@ -1930,7 +1930,7 @@ spacesplit(char *s, int allownull, int heap, int quote)
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) {
/*
@@ -1957,7 +1957,7 @@ spacesplit(char *s, int allownull, int heap, int quote)
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);
@@ -2129,7 +2129,7 @@ sepjoin(char **s, char *sep, int heap)
}
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);
@@ -2153,13 +2153,13 @@ sepsplit(char *s, char *sep, int allownull, int heap)
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++;