From: espie Date: Tue, 22 Apr 2014 08:26:31 +0000 (+0000) Subject: effectively use emult_realloc, okay guenther@ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=75d77f2cf6261022bb1a161d4794efafcd752ac4;p=openbsd effectively use emult_realloc, okay guenther@ --- diff --git a/usr.bin/make/garray.h b/usr.bin/make/garray.h index 01ba165d76b..c8d67082266 100644 --- a/usr.bin/make/garray.h +++ b/usr.bin/make/garray.h @@ -1,7 +1,7 @@ #ifndef GARRAY_H #define GARRAY_H -/* $OpenBSD: garray.h,v 1.6 2010/07/19 19:46:44 espie Exp $ */ +/* $OpenBSD: garray.h,v 1.7 2014/04/22 08:26:31 espie Exp $ */ /* Growable array implementation */ /* @@ -52,8 +52,8 @@ do { \ do { \ if ((l)->n >= (l)->size) { \ (l)->size *= 2; \ - (l)->a = erealloc((l)->a, \ - sizeof(struct GNode *) * (l)->size);\ + (l)->a = emult_realloc((l)->a, \ + (l)->size, sizeof(struct GNode *)); \ MAY_INCREASE_STATS; \ } \ (l)->a[(l)->n++] = (gn); \ diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 8aee1e375f2..755d65f2a25 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -1,4 +1,4 @@ -/* $OpenBSD: str.c,v 1.28 2013/11/22 15:47:35 espie Exp $ */ +/* $OpenBSD: str.c,v 1.29 2014/04/22 08:26:31 espie Exp $ */ /* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */ /*- @@ -150,8 +150,8 @@ brk_string(const char *str, int *store_argc, char **buffer) *t++ = '\0'; if (argc == argmax) { argmax *= 2; /* ramp up fast */ - argv = erealloc(argv, - (argmax + 1) * sizeof(char *)); + argv = emult_realloc(argv, + (argmax + 1), sizeof(char *)); } argv[argc++] = start; start = NULL; diff --git a/usr.bin/make/varmodifiers.c b/usr.bin/make/varmodifiers.c index abb73092711..149d5c3959f 100644 --- a/usr.bin/make/varmodifiers.c +++ b/usr.bin/make/varmodifiers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: varmodifiers.c,v 1.35 2013/11/22 15:47:35 espie Exp $ */ +/* $OpenBSD: varmodifiers.c,v 1.36 2014/04/22 08:26:31 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -460,14 +460,14 @@ do_sort(const char *s, const struct Name *dummy UNUSED, void *arg UNUSED) const char *start, *end; n = 1024; /* start at 1024 words */ - t = (struct Name *)emalloc(sizeof(struct Name) * n); + t = ecalloc(n, sizeof(struct Name)); start = s; end = start; for (i = 0;; i++) { if (i == n) { n *= 2; - t = (struct Name *)erealloc(t, sizeof(struct Name) * n); + t = emult_realloc(t, n, sizeof(struct Name)); } start = iterate_words(&end); if (start == NULL)