summaryrefslogtreecommitdiff
path: root/editors/awk.c
diff options
context:
space:
mode:
authorRob Landley2006-05-21 18:30:35 +0000
committerRob Landley2006-05-21 18:30:35 +0000
commit9ffd42317b5a53c2236268808e34c90601f286c1 (patch)
treeb126ca6ff7d2db91fa3525c6e5d3978932137fa3 /editors/awk.c
parentc020f5f518714af603488c7d9e6cc72543fabc49 (diff)
downloadbusybox-9ffd42317b5a53c2236268808e34c90601f286c1.zip
busybox-9ffd42317b5a53c2236268808e34c90601f286c1.tar.gz
Minor cleanups: Convert a few calloc() calls to xzalloc, remove unnecessary
memset, collate variable declarations...
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/editors/awk.c b/editors/awk.c
index f4eb1ab..74f9d8e 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -474,9 +474,9 @@ static xhash *hash_init(void)
{
xhash *newhash;
- newhash = (xhash *)xcalloc(1, sizeof(xhash));
+ newhash = (xhash *)xzalloc(sizeof(xhash));
newhash->csize = FIRST_PRIME;
- newhash->items = (hash_item **)xcalloc(newhash->csize, sizeof(hash_item *));
+ newhash->items = (hash_item **)xzalloc(newhash->csize * sizeof(hash_item *));
return newhash;
}
@@ -505,7 +505,7 @@ static void hash_rebuild(xhash *hash)
return;
newsize = PRIMES[hash->nprime++];
- newitems = (hash_item **)xcalloc(newsize, sizeof(hash_item *));
+ newitems = (hash_item **)xzalloc(newsize * sizeof(hash_item *));
for (i=0; i<hash->csize; i++) {
hi = hash->items[i];
@@ -536,7 +536,7 @@ static void *hash_find(xhash *hash, const char *name)
hash_rebuild(hash);
l = strlen(name) + 1;
- hi = xcalloc(sizeof(hash_item) + l, 1);
+ hi = xzalloc(sizeof(hash_item) + l);
memcpy(hi->name, name, l);
idx = hashidx(name) % hash->csize;
@@ -993,7 +993,7 @@ static node *new_node(uint32_t info)
{
register node *n;
- n = (node *)xcalloc(sizeof(node), 1);
+ n = (node *)xzalloc(sizeof(node));
n->info = info;
n->lineno = lineno;
return n;
@@ -1095,7 +1095,7 @@ static node *parse_expr(uint32_t iexp)
case TC_NUMBER:
case TC_STRING:
cn->info = OC_VAR;
- v = cn->l.v = xcalloc(sizeof(var), 1);
+ v = cn->l.v = xzalloc(sizeof(var));
if (tc & TC_NUMBER)
setvar_i(v, t.number);
else
@@ -1104,7 +1104,7 @@ static node *parse_expr(uint32_t iexp)
case TC_REGEXP:
mk_re_node(t.string, cn,
- (regex_t *)xcalloc(sizeof(regex_t),2));
+ (regex_t *)xzalloc(sizeof(regex_t)*2));
break;
case TC_FUNCTION:
@@ -1590,7 +1590,7 @@ static void hashwalk_init(var *v, xhash *array)
free(v->x.walker);
v->type |= VF_WALK;
- w = v->x.walker = (char **)xcalloc(2 + 2*sizeof(char *) + array->glen, 1);
+ w = v->x.walker = (char **)xzalloc(2 + 2*sizeof(char *) + array->glen);
*w = *(w+1) = (char *)(w + 2);
for (i=0; i<array->csize; i++) {
hi = array->items[i];