summaryrefslogtreecommitdiff
path: root/xmalloc.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2015-07-02 13:15:34 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2015-07-02 13:15:34 +0000
commitc1e0861503468de5ae00ed0e532f349ec78bec68 (patch)
tree14de9b5b2b4cbd1116ed28f9b7189c866585b230 /xmalloc.c
parentc0bbca73c6f7f15d5401332151fc9f9755abaf8f (diff)
downloadsrc-test2-c1e0861503468de5ae00ed0e532f349ec78bec68.tar.gz
src-test2-c1e0861503468de5ae00ed0e532f349ec78bec68.zip
Notes
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/xmalloc.c b/xmalloc.c
index 2f1cd2306945..cd59dc2e5bef 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.29 2014/01/04 17:50:55 tedu Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.31 2015/02/06 23:21:59 millert Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -15,8 +15,10 @@
#include "includes.h"
-#include <sys/param.h>
#include <stdarg.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,8 +46,8 @@ xcalloc(size_t nmemb, size_t size)
if (size == 0 || nmemb == 0)
fatal("xcalloc: zero size");
- if (SIZE_T_MAX / nmemb < size)
- fatal("xcalloc: nmemb * size > SIZE_T_MAX");
+ if (SIZE_MAX / nmemb < size)
+ fatal("xcalloc: nmemb * size > SIZE_MAX");
ptr = calloc(nmemb, size);
if (ptr == NULL)
fatal("xcalloc: out of memory (allocating %zu bytes)",
@@ -61,8 +63,8 @@ xrealloc(void *ptr, size_t nmemb, size_t size)
if (new_size == 0)
fatal("xrealloc: zero size");
- if (SIZE_T_MAX / nmemb < size)
- fatal("xrealloc: nmemb * size > SIZE_T_MAX");
+ if (SIZE_MAX / nmemb < size)
+ fatal("xrealloc: nmemb * size > SIZE_MAX");
if (ptr == NULL)
new_ptr = malloc(new_size);
else