diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-02-03 01:10:11 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2021-02-03 01:10:11 +0000 |
commit | c0a6d2e0bbdc6ce945d0e650dc2bd230cc56f7fb (patch) | |
tree | 6afc6e7868dcc5898e3c61a2b9644b9ccf70d3d5 | |
parent | d9c5571b35e25d9ae00e663be151b81c320e70cf (diff) |
remove ancient malloc ? realloc dance. always use realloc.
ok millert tb
-rw-r--r-- | usr.bin/yacc/skeleton.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c index 3f0ce924b2b..295cabc2e5a 100644 --- a/usr.bin/yacc/skeleton.c +++ b/usr.bin/yacc/skeleton.c @@ -1,4 +1,4 @@ -/* $OpenBSD: skeleton.c,v 1.39 2015/12/31 23:22:39 guenther Exp $ */ +/* $OpenBSD: skeleton.c,v 1.40 2021/02/03 01:10:10 deraadt Exp $ */ /* $NetBSD: skeleton.c,v 1.10 1996/03/25 00:36:18 mrg Exp $ */ /* @@ -138,16 +138,14 @@ char *body[] = "#endif", " if (newsize && YY_SIZE_MAX / newsize < sizeof *newss)", " goto bail;", - " newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :", - " (short *)malloc(newsize * sizeof *newss); /* overflow check above */", + " newss = (short *)realloc(yyss, newsize * sizeof *newss);", " if (newss == NULL)", " goto bail;", " yyss = newss;", " yyssp = newss + sslen;", " if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs)", " goto bail;", - " newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :", - " (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */", + " newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs);", " if (newvs == NULL)", " goto bail;", " yyvs = newvs;", |