diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2017-06-22 08:26:27 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2017-06-22 08:26:27 -0400 |
commit | 288b15d0793936fa14b51ed860056f6ce6200c52 (patch) | |
tree | 5de9e9dca8b30e8d168da8661ae88e3ffe2504a3 /awkgram.y | |
parent | b7d8b6ebcd5dd714bc21acf7637d9a651e2f7ea7 (diff) | |
download | egawk-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.y | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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]; |