diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2017-08-17 19:27:49 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2017-08-17 19:27:49 +0000 |
commit | bbec3ce5ff9da1b4b861e6bc82e0f24f013e6852 (patch) | |
tree | ee0e8633951ef26386c79b5b49e45530e94d17b8 /usr.bin/lex/filter.c | |
parent | 4dfd02516f6c8c51bfa327b397062b6817363c87 (diff) |
combine malloc/memset into calloc. from Michael W. Bombardieri
Diffstat (limited to 'usr.bin/lex/filter.c')
-rw-r--r-- | usr.bin/lex/filter.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/lex/filter.c b/usr.bin/lex/filter.c index 3ae77c450cf..558e038d2e6 100644 --- a/usr.bin/lex/filter.c +++ b/usr.bin/lex/filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.c,v 1.7 2016/12/18 06:11:23 krw Exp $ */ +/* $OpenBSD: filter.c,v 1.8 2017/08/17 19:27:48 tedu Exp $ */ /* filter - postprocessing of flex output through filters */ @@ -50,10 +50,9 @@ filter_create_ext(struct filter * chain, const char *cmd, va_list ap; /* allocate and initialize new filter */ - f = malloc(sizeof(struct filter)); + f = calloc(sizeof(struct filter), 1); if (!f) - flexerror(_("malloc failed (f) in filter_create_ext")); - memset(f, 0, sizeof(*f)); + flexerror(_("calloc failed (f) in filter_create_ext")); f->filter_func = NULL; f->extra = NULL; f->next = NULL; @@ -103,10 +102,9 @@ filter_create_int(struct filter * chain, struct filter *f; /* allocate and initialize new filter */ - f = malloc(sizeof(struct filter)); + f = calloc(sizeof(struct filter), 1); if (!f) - flexerror(_("malloc failed in filter_create_int")); - memset(f, 0, sizeof(*f)); + flexerror(_("calloc failed in filter_create_int")); f->next = NULL; f->argc = 0; f->argv = NULL; |