]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: add xmemdup
authorLuca Boccassi <bluca@debian.org>
Sat, 12 Aug 2023 22:14:13 +0000 (23:14 +0100)
committerLuca Boccassi <bluca@debian.org>
Mon, 9 Oct 2023 21:22:09 +0000 (22:22 +0100)
src/boot/efi/util.h

index 2f8c96d0ac67f05a3cb1cd1039085cf6d220efe2..25f35d2b5d72b3c82f9d5763b4276eedc69c0688 100644 (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 {