]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Use ASSERT_PTR
authorJan Janssen <medhefgo@web.de>
Wed, 19 Jan 2022 11:10:32 +0000 (12:10 +0100)
committerJan Janssen <medhefgo@web.de>
Wed, 26 Jan 2022 17:07:00 +0000 (18:07 +0100)
src/boot/efi/util.h

index b60814b4919e87789a17b020ee9c7d569d3baa40..40ce98c6110893150a7da32056732f27283f5dce 100644 (file)
 #define UINT64_MAX ((UINT64) -1)
 #endif
 
-#define assert_alloc_ret(p)     \
-        ({                      \
-                void *_p = (p); \
-                assert(_p);     \
-                _p;             \
-        })
-
 #define xnew_alloc(type, n, alloc)                                           \
         ({                                                                   \
                 UINTN _alloc_size;                                           \
                 (type *) alloc(_alloc_size);                                 \
         })
 
-#define xallocate_pool(size) assert_alloc_ret(AllocatePool(size))
-#define xallocate_zero_pool(size) assert_alloc_ret(AllocateZeroPool(size))
-#define xreallocate_pool(p, old_size, new_size) assert_alloc_ret(ReallocatePool((p), (old_size), (new_size)))
-#define xpool_print(fmt, ...) ((CHAR16 *) assert_alloc_ret(PoolPrint((fmt), ##__VA_ARGS__)))
-#define xstrdup(str) ((CHAR16 *) assert_alloc_ret(StrDuplicate(str)))
+#define xallocate_pool(size) ASSERT_PTR(AllocatePool(size))
+#define xallocate_zero_pool(size) ASSERT_PTR(AllocateZeroPool(size))
+#define xreallocate_pool(p, old_size, new_size) ASSERT_PTR(ReallocatePool((p), (old_size), (new_size)))
+#define xpool_print(fmt, ...) ((CHAR16 *) ASSERT_PTR(PoolPrint((fmt), ##__VA_ARGS__)))
+#define xstrdup(str) ((CHAR16 *) ASSERT_PTR(StrDuplicate(str)))
 #define xnew(type, n) xnew_alloc(type, (n), xallocate_pool)
 #define xnew0(type, n) xnew_alloc(type, (n), xallocate_zero_pool)