summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2007-03-29 21:07:17 +0000
committerjasone <jasone@FreeBSD.org>2007-03-29 21:07:17 +0000
commit26e0e354b030e8049b434ff176c44e2247497401 (patch)
tree2553da61d589e85e6f6e9a81d6ff835376890c98 /lib
parent78bc9b6aa1399a04a7fe5c42c19f6667df93b3fa (diff)
downloadFreeBSD-src-26e0e354b030e8049b434ff176c44e2247497401.zip
FreeBSD-src-26e0e354b030e8049b434ff176c44e2247497401.tar.gz
Use size_t instead of unsigned for pagesize-related values, in order to
avoid downcasting issues. In particular, this change fixes posix_memalign(3) for alignments greater than 2^31 on LP64 systems. Make sure that NDEBUG is always set to be compatible with MALLOC_DEBUG. [1] Reported by: [1] Lee Hyo geol <hyogeollee@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/malloc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index ced8511..4bb2a92 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -146,7 +146,11 @@ __FBSDID("$FreeBSD$");
# define MALLOC_STATS
#endif
-#ifndef MALLOC_DEBUG
+#ifdef MALLOC_DEBUG
+# ifdef NDEBUG
+# undef NDEBUG
+# endif
+#else
# ifndef NDEBUG
# define NDEBUG
# endif
@@ -549,9 +553,9 @@ struct arena_s {
static unsigned ncpus;
/* VM page size. */
-static unsigned pagesize;
-static unsigned pagesize_mask;
-static unsigned pagesize_2pow;
+static size_t pagesize;
+static size_t pagesize_mask;
+static size_t pagesize_2pow;
/* Various bin-related settings. */
static size_t bin_maxclass; /* Max size class for bins. */
OpenPOWER on IntegriCloud