From 4eeb52f080edb1f4b518249388f6c617386c00e5 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Mon, 2 Apr 2012 01:46:25 -0700 Subject: [PATCH] Remove vsnprintf() and strtoumax() validation. Remove code that validates malloc_vsnprintf() and malloc_strtoumax() against their namesakes. The validation code has adequately served its usefulness at this point, and it isn't worth dealing with the different formatting for %p with glibc versus other implementations for NULL pointers ("(nil)" vs. "0x0"). Reported by Mike Hommey. --- .../jemalloc/internal/jemalloc_internal.h.in | 2 -- src/jemalloc.c | 2 +- src/util.c | 27 ------------------- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in index b7b8df8b..9e57b62b 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -374,8 +374,6 @@ extern malloc_mutex_t arenas_lock; /* Protects arenas initialization. */ extern arena_t **arenas; extern unsigned narenas; -extern bool malloc_initialized; - arena_t *arenas_extend(unsigned ind); void arenas_cleanup(void *arg); arena_t *choose_arena_hard(void); diff --git a/src/jemalloc.c b/src/jemalloc.c index c0fe6c91..5b1e0fdd 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -38,7 +38,7 @@ arena_t **arenas; unsigned narenas; /* Set to true once the allocator has been initialized. */ -bool malloc_initialized = false; +static bool malloc_initialized = false; #ifdef JEMALLOC_THREADED_INIT /* Used to let the initializing thread recursively allocate. */ diff --git a/src/util.c b/src/util.c index 895aa198..107bdcff 100644 --- a/src/util.c +++ b/src/util.c @@ -179,20 +179,6 @@ malloc_strtoumax(const char *nptr, char **endptr, int base) *endptr = (char *)p; } - if (config_debug && malloc_initialized) { - uintmax_t tret; - int perrno; - char *pend; - - perrno = errno; - if (endptr != NULL) - pend = *endptr; - tret = strtoumax(nptr, endptr, base); - assert(tret == ret); - assert(errno == perrno); - assert(endptr == NULL || *endptr == pend); - } - return (ret); } @@ -563,19 +549,6 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) str[size - 1] = '\0'; ret = i; - if (config_debug && malloc_initialized) { - char buf[MALLOC_PRINTF_BUFSIZE]; - int tret; - - /* - * Verify that the resulting string matches what vsnprintf() - * would have created. - */ - tret = vsnprintf(buf, sizeof(buf), format, tap); - assert(tret == ret); - assert(strcmp(buf, str) == 0); - } - #undef APPEND_C #undef APPEND_S #undef APPEND_PADDED_S