From 26e0e354b030e8049b434ff176c44e2247497401 Mon Sep 17 00:00:00 2001 From: jasone Date: Thu, 29 Mar 2007 21:07:17 +0000 Subject: 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 --- lib/libc/stdlib/malloc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/libc/stdlib/malloc.c') 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. */ -- cgit v1.1