boot: Make free() a non inline function
The static inline declaration in iovec-fundamental.h causes static analyze tooling warnings (clang-tidy). Let's get around it by making free() non-inline. LTO will make sure it's still inlined properly.
This commit is contained in:
@@ -13,6 +13,19 @@
|
||||
/* Never try to read more than 16G into memory (and on 32bit 1G) */
|
||||
#define FILE_READ_MAX MIN(SIZE_MAX/4, UINT64_C(16)*1024U*1024U*1024U)
|
||||
|
||||
void free(void *p) {
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
/* Debugging an invalid free requires trace logging to find the call site or a debugger attached. For
|
||||
* release builds it is not worth the bother to even warn when we cannot even print a call stack. */
|
||||
#ifdef EFI_DEBUG
|
||||
assert_se(BS->FreePool(p) == EFI_SUCCESS);
|
||||
#else
|
||||
(void) BS->FreePool(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
void convert_efi_path(char16_t *path) {
|
||||
assert(path);
|
||||
|
||||
|
||||
+3
-12
@@ -14,18 +14,9 @@
|
||||
/* This is provided by the linker. */
|
||||
extern uint8_t __executable_start[];
|
||||
|
||||
static inline void free(void *p) {
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
/* Debugging an invalid free requires trace logging to find the call site or a debugger attached. For
|
||||
* release builds it is not worth the bother to even warn when we cannot even print a call stack. */
|
||||
#ifdef EFI_DEBUG
|
||||
assert_se(BS->FreePool(p) == EFI_SUCCESS);
|
||||
#else
|
||||
(void) BS->FreePool(p);
|
||||
#endif
|
||||
}
|
||||
DISABLE_WARNING_REDUNDANT_DECLS;
|
||||
void free(void *p);
|
||||
REENABLE_WARNING;
|
||||
|
||||
static inline void freep(void *p) {
|
||||
free(*(void **) p);
|
||||
|
||||
@@ -17,7 +17,7 @@ struct iovec {
|
||||
};
|
||||
|
||||
DISABLE_WARNING_REDUNDANT_DECLS;
|
||||
static inline void free(void *p);
|
||||
void free(void *p);
|
||||
REENABLE_WARNING;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user