From 3f1962dd2bb367a49d39c2e564172010865174b0 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Thu, 18 Oct 2018 15:25:14 -0400 Subject: [PATCH] use min macro for realloc copy size --- malloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/malloc.c b/malloc.c index 7ba8c28..543db19 100644 --- a/malloc.c +++ b/malloc.c @@ -1023,7 +1023,7 @@ EXPORT void *h_realloc(void *old, size_t size) { } } - size_t copy_size = size < old_size ? size : old_size; + size_t copy_size = min(size, old_size); if (copy_size >= MREMAP_MOVE_THRESHOLD) { void *new = allocate(size); if (new == NULL) { @@ -1054,7 +1054,7 @@ EXPORT void *h_realloc(void *old, size_t size) { if (new == NULL) { return NULL; } - size_t copy_size = size < old_size ? size : old_size; + size_t copy_size = min(size, old_size); if (size > 0 && size <= max_slab_size_class) { copy_size -= canary_size; }