Skip to content

Commit cd89708

Browse files
committed
Fix test_vest to correctly handle mock_defrag
Signed-off-by: Ran Shidlansik <[email protected]>
1 parent 678e51d commit cd89708

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/unit/test_vset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ int expire_mock_entries(vset *set, mstime_t now) {
401401
}
402402

403403
void *mock_defragfn(void *ptr) {
404-
size_t size = zmalloc_size(ptr);
404+
size_t size = zmalloc_usable_size(ptr);
405405
void *newptr = zmalloc(size);
406406
memcpy(newptr, ptr, size);
407407
zfree(ptr);

src/zmalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#error "Newer version of jemalloc required"
5959
#endif
6060

61-
#elif defined(__APPLE__)
61+
#elif defined(__APPLE__) && !defined(NO_MALLOC_USABLE_SIZE)
6262
#include <malloc/malloc.h>
6363
#define HAVE_MALLOC_SIZE 1
6464
#define zmalloc_size(p) malloc_size(p)

0 commit comments

Comments
 (0)