use min macro for realloc copy size

This commit is contained in:
Daniel Micay 2018-10-18 15:25:14 -04:00
parent fe30f6c2ea
commit 3f1962dd2b

View File

@ -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) { if (copy_size >= MREMAP_MOVE_THRESHOLD) {
void *new = allocate(size); void *new = allocate(size);
if (new == NULL) { if (new == NULL) {
@ -1054,7 +1054,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
if (new == NULL) { if (new == NULL) {
return 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) { if (size > 0 && size <= max_slab_size_class) {
copy_size -= canary_size; copy_size -= canary_size;
} }