boot: Simplify object erasure

This erase_obj() machinery looks like voodoo and creates an awful lot of
noise as soon as we get back to building with -O0. We can do this in a
more simple way by introducing a struct that holds the information we
need on cleanup. When building with optimization enabled, all this gets
inlined and the eraser vanishes.
This commit is contained in:
Jan Janssen
2023-01-09 18:58:54 +01:00
committed by Lennart Poettering
parent f977356a82
commit 3f92dc2fd4
8 changed files with 52 additions and 63 deletions
+1 -11
View File
@@ -9,6 +9,7 @@
#include "alloc-util.h"
#include "macro.h"
#include "memory-util-fundamental.h"
size_t page_size(void) _pure_;
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
@@ -91,17 +92,6 @@ static inline void *mempmem_safe(const void *haystack, size_t haystacklen, const
return (uint8_t*) p + needlelen;
}
#if HAVE_EXPLICIT_BZERO
static inline void* explicit_bzero_safe(void *p, size_t l) {
if (l > 0)
explicit_bzero(p, l);
return p;
}
#else
void *explicit_bzero_safe(void *p, size_t l);
#endif
static inline void* erase_and_free(void *p) {
size_t l;