aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.y
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2017-06-22 08:26:27 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2017-06-22 08:26:27 -0400
commit288b15d0793936fa14b51ed860056f6ce6200c52 (patch)
tree5de9e9dca8b30e8d168da8661ae88e3ffe2504a3 /awkgram.y
parentb7d8b6ebcd5dd714bc21acf7637d9a651e2f7ea7 (diff)
downloadegawk-288b15d0793936fa14b51ed860056f6ce6200c52.tar.gz
egawk-288b15d0793936fa14b51ed860056f6ce6200c52.tar.bz2
egawk-288b15d0793936fa14b51ed860056f6ce6200c52.zip
Replace malloc+memset with calloc, mostly by using the new ezalloc macro.
Diffstat (limited to 'awkgram.y')
-rw-r--r--awkgram.y9
1 files changed, 3 insertions, 6 deletions
diff --git a/awkgram.y b/awkgram.y
index e4f5bab0..ad6873bb 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -2393,8 +2393,7 @@ yyerror(const char *m, ...)
count = strlen(mesg) + 1;
if (lexptr != NULL)
count += (lexeme - thisline) + 2;
- emalloc(buf, char *, count+1, "yyerror");
- memset(buf, 0, count+1);
+ ezalloc(buf, char *, count+1, "yyerror");
bp = buf;
@@ -2613,8 +2612,7 @@ do_add_srcfile(enum srctype stype, char *src, char *path, SRCFILE *thisfile)
{
SRCFILE *s;
- emalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile");
- memset(s, 0, sizeof(SRCFILE));
+ ezalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile");
s->src = estrdup(src, strlen(src));
s->fullpath = path;
s->stype = stype;
@@ -4893,8 +4891,7 @@ func_use(const char *name, enum defref how)
/* not in the table, fall through to allocate a new one */
- emalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use");
- memset(fp, '\0', sizeof(struct fdesc));
+ ezalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use");
emalloc(fp->name, char *, len + 1, "func_use");
strcpy(fp->name, name);
fp->next = ftable[ind];