malloc: Fix unused internal_memalign warning with mcheck

When CONFIG_MCHECK_HEAP_PROTECTION is enabled, dlmemalign_impl() calls
dlmalloc_impl() directly since the mcheck wrapper handles alignment.
This leaves internal_memalign() unused, causing a compiler warning.

Guard internal_memalign() with a preprocessor check so it's only
compiled when needed (mcheck disabled or MSPACES enabled).

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-02 14:33:04 +00:00
parent 0cf38dc8c8
commit a91d1a5541

View File

@@ -5309,6 +5309,7 @@ static mchunkptr try_realloc_chunk(mstate m, mchunkptr p, size_t nb,
}
#endif /* !defined(__UBOOT__) || !NO_REALLOC_IN_PLACE */
#if !CONFIG_IS_ENABLED(MCHECK_HEAP_PROTECTION) || MSPACES
static void* internal_memalign(mstate m, size_t alignment, size_t bytes) {
void* mem = 0;
if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */
@@ -5422,6 +5423,7 @@ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) {
}
return mem;
}
#endif /* !CONFIG_MCHECK_HEAP_PROTECTION || MSPACES */
/*
Common support for independent_X routines, handling