Conversation
| #define MALLOC_SIZE(s) malloc_usable_size(s) | ||
| #elif defined(TARGET_SUNOS) | ||
| #elif defined(TARGET_OPENBSD) || defined(TARGET_SUNOS) | ||
| #define MALLOC_SIZE(s) (*((size_t*)(s)-1)) |
There was a problem hiding this comment.
Does this implementation actually work on OpenBSD?
There was a problem hiding this comment.
Now that I look at it again - no I do not think it will at all.
I don't think there is any implementation of malloc_size that will work. A bit unsure how to proceed here?
There was a problem hiding this comment.
This is only need for efficient implementation of aligned realloc. You should be able to provide less efficient implementation that does not depend on malloc_size
There was a problem hiding this comment.
(Every C allocator has to know the size internally to support realloc. It is unfortunate that OpenBSD does not expose it as an API. they have it as an internal macro only https://github.com/libressl/openbsd/blob/master/src/lib/libc/stdlib/malloc.c#L328-L330 .)
OpenBSD does not have an implementation of
MALLOC_SIZEso reuse theTARGET_SUNOSone.