efi: add xmemdup

This commit is contained in:
Luca Boccassi
2023-10-09 22:22:09 +01:00
parent d869ec4ab0
commit 3e5a499009
+5
View File
@@ -58,6 +58,11 @@ static inline void *xrealloc(void *p, size_t old_size, size_t new_size) {
return t;
}
_malloc_ _alloc_(2) _returns_nonnull_ _warn_unused_result_
static inline void* xmemdup(const void *p, size_t l) {
return memcpy(xmalloc(l), p, l);
}
#define xnew(type, n) ((type *) xmalloc_multiply(sizeof(type), (n)))
typedef struct {