mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix -Wdefault-const-init-field-unsafe with clang 21 (#21135)
Fixes the following warning:
Zend/zend_alloc.c:3469:18: error: default initialization of an object of type 'zend_mm_storage' (aka 'struct _zend_mm_storage') with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
3469 | zend_mm_storage tmp_storage, *storage;
| ^
Zend/zend_alloc.h:313:25: note: member 'handlers' declared 'const' here
313 | const zend_mm_handlers handlers;
| ^
This commit is contained in:
@@ -3465,12 +3465,14 @@ ZEND_API zend_mm_heap *zend_mm_startup(void)
|
||||
ZEND_API zend_mm_heap *zend_mm_startup_ex(const zend_mm_handlers *handlers, void *data, size_t data_size)
|
||||
{
|
||||
#if ZEND_MM_STORAGE
|
||||
zend_mm_storage tmp_storage, *storage;
|
||||
zend_mm_storage *storage;
|
||||
zend_mm_storage tmp_storage = {
|
||||
.handlers = *handlers,
|
||||
.data = data,
|
||||
};
|
||||
zend_mm_chunk *chunk;
|
||||
zend_mm_heap *heap;
|
||||
|
||||
memcpy((zend_mm_handlers*)&tmp_storage.handlers, handlers, sizeof(zend_mm_handlers));
|
||||
tmp_storage.data = data;
|
||||
chunk = (zend_mm_chunk*)handlers->chunk_alloc(&tmp_storage, ZEND_MM_CHUNK_SIZE, ZEND_MM_CHUNK_SIZE);
|
||||
if (UNEXPECTED(chunk == NULL)) {
|
||||
#if ZEND_MM_ERROR
|
||||
|
||||
Reference in New Issue
Block a user