diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-03-05 16:10:35 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2017-03-05 16:10:35 +0000 |
commit | 63433bc937051f84486b603e9803597db68f796b (patch) | |
tree | 3b85912a1a98333288adba4e1610a49447f3a2f2 /usr.bin/dc | |
parent | d457839bc81ca7d922661f349b8b9a0e3fe13238 (diff) | |
download | src-63433bc937051f84486b603e9803597db68f796b.tar.gz src-63433bc937051f84486b603e9803597db68f796b.zip |
Notes
Diffstat (limited to 'usr.bin/dc')
-rw-r--r-- | usr.bin/dc/bcode.c | 4 | ||||
-rw-r--r-- | usr.bin/dc/extern.h | 4 | ||||
-rw-r--r-- | usr.bin/dc/inout.c | 4 | ||||
-rw-r--r-- | usr.bin/dc/mem.c | 6 | ||||
-rw-r--r-- | usr.bin/dc/stack.c | 8 |
5 files changed, 13 insertions, 13 deletions
diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c index e6a980e4ac23..fc83282b4e01 100644 --- a/usr.bin/dc/bcode.c +++ b/usr.bin/dc/bcode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcode.c,v 1.45 2012/11/07 11:06:14 otto Exp $ */ +/* $OpenBSD: bcode.c,v 1.46 2014/10/08 03:59:56 doug Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -1709,7 +1709,7 @@ eval_string(char *p) if (bmachine.readsp == bmachine.readstack_sz - 1) { size_t newsz = bmachine.readstack_sz * 2; struct source *stack; - stack = realloc(bmachine.readstack, newsz * + stack = reallocarray(bmachine.readstack, newsz, sizeof(struct source)); if (stack == NULL) err(1, "recursion too deep"); diff --git a/usr.bin/dc/extern.h b/usr.bin/dc/extern.h index 4abf06355a3a..477fcea9eb61 100644 --- a/usr.bin/dc/extern.h +++ b/usr.bin/dc/extern.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $OpenBSD: extern.h,v 1.3 2006/01/16 08:09:25 otto Exp $ */ +/* $OpenBSD: extern.h,v 1.4 2014/12/01 13:13:00 deraadt Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -35,7 +35,7 @@ struct number *new_number(void); void free_number(struct number *); struct number *dup_number(const struct number *); void *bmalloc(size_t); -void *brealloc(void *, size_t); +void *breallocarray(void *, size_t, size_t); char *bstrdup(const char *p); void bn_check(int); void bn_checkp(const void *); diff --git a/usr.bin/dc/inout.c b/usr.bin/dc/inout.c index 740fb35bae7f..bd675f51023a 100644 --- a/usr.bin/dc/inout.c +++ b/usr.bin/dc/inout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inout.c,v 1.17 2012/11/07 11:06:14 otto Exp $ */ +/* $OpenBSD: inout.c,v 1.18 2014/12/01 13:13:00 deraadt Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -261,7 +261,7 @@ read_string(struct source *src) escape = false; if (i == sz) { new_sz = sz * 2; - p = brealloc(p, new_sz + 1); + p = breallocarray(p, 1, new_sz + 1); sz = new_sz; } p[i++] = ch; diff --git a/usr.bin/dc/mem.c b/usr.bin/dc/mem.c index 78fb429e2604..e83a70ad5ec8 100644 --- a/usr.bin/dc/mem.c +++ b/usr.bin/dc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.5 2009/10/27 23:59:37 deraadt Exp $ */ +/* $OpenBSD: mem.c,v 1.6 2014/12/01 13:13:00 deraadt Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -72,11 +72,11 @@ bmalloc(size_t sz) } void * -brealloc(void *p, size_t sz) +breallocarray(void *p, size_t nmemb, size_t size) { void *q; - q = realloc(p, sz); + q = reallocarray(p, nmemb, size); if (q == NULL) err(1, NULL); return (q); diff --git a/usr.bin/dc/stack.c b/usr.bin/dc/stack.c index 33082c77ec04..ba7c7e4a589b 100644 --- a/usr.bin/dc/stack.c +++ b/usr.bin/dc/stack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stack.c,v 1.12 2014/11/26 15:05:51 otto Exp $ */ +/* $OpenBSD: stack.c,v 1.13 2014/12/01 13:13:00 deraadt Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -139,8 +139,8 @@ stack_grow(struct stack *stack) if (++stack->sp == stack->size) { new_size = stack->size * 2 + 1; - stack->stack = brealloc(stack->stack, - new_size * sizeof(*stack->stack)); + stack->stack = breallocarray(stack->stack, + new_size, sizeof(*stack->stack)); stack->size = new_size; } } @@ -313,7 +313,7 @@ array_grow(struct array *array, size_t newsize) { size_t i; - array->data = brealloc(array->data, newsize * sizeof(*array->data)); + array->data = breallocarray(array->data, newsize, sizeof(*array->data)); for (i = array->size; i < newsize; i++) { array->data[i].type = BCODE_NONE; array->data[i].array = NULL; |