|
27 | 27 | #define xnew_alloc(type, n, alloc) \ |
28 | 28 | ({ \ |
29 | 29 | UINTN _alloc_size; \ |
30 | | - if (__builtin_mul_overflow(sizeof(type), (n), &_alloc_size)) \ |
31 | | - assert_not_reached(); \ |
| 30 | + assert_se(!__builtin_mul_overflow(sizeof(type), (n), &_alloc_size)); \ |
32 | 31 | (type *) alloc(_alloc_size); \ |
33 | 32 | }) |
34 | 33 |
|
35 | | -#define xallocate_pool(size) ASSERT_PTR(AllocatePool(size)) |
36 | | -#define xallocate_zero_pool(size) ASSERT_PTR(AllocateZeroPool(size)) |
37 | | -#define xreallocate_pool(p, old_size, new_size) ASSERT_PTR(ReallocatePool((p), (old_size), (new_size))) |
38 | | -#define xpool_print(fmt, ...) ((CHAR16 *) ASSERT_PTR(PoolPrint((fmt), ##__VA_ARGS__))) |
39 | | -#define xstrdup(str) ((CHAR16 *) ASSERT_PTR(StrDuplicate(str))) |
| 34 | +#define xallocate_pool(size) ASSERT_SE_PTR(AllocatePool(size)) |
| 35 | +#define xallocate_zero_pool(size) ASSERT_SE_PTR(AllocateZeroPool(size)) |
| 36 | +#define xreallocate_pool(p, old_size, new_size) ASSERT_SE_PTR(ReallocatePool((p), (old_size), (new_size))) |
| 37 | +#define xpool_print(fmt, ...) ((CHAR16 *) ASSERT_SE_PTR(PoolPrint((fmt), ##__VA_ARGS__))) |
| 38 | +#define xstrdup(str) ((CHAR16 *) ASSERT_SE_PTR(StrDuplicate(str))) |
40 | 39 | #define xnew(type, n) xnew_alloc(type, (n), xallocate_pool) |
41 | 40 | #define xnew0(type, n) xnew_alloc(type, (n), xallocate_zero_pool) |
42 | 41 |
|
|
0 commit comments