mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
alloc-util: reallocarray() exists since glibc-2.26
This commit is contained in:
@@ -119,15 +119,6 @@ _malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t need, size_t s
|
||||
return malloc(size * need ?: 1);
|
||||
}
|
||||
|
||||
#if !HAVE_REALLOCARRAY
|
||||
_alloc_(2, 3) static inline void *reallocarray(void *p, size_t need, size_t size) {
|
||||
if (size_multiply_overflow(size, need))
|
||||
return NULL;
|
||||
|
||||
return realloc(p, size * need ?: 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
_alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t need, size_t size) {
|
||||
if (size_multiply_overflow(size, need))
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user