diff options
author | Jan Janssen <medhefgo@web.de> | 2023-01-07 22:16:52 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-01-09 18:58:54 +0100 |
commit | 3f92dc2fd4070b213e6bc85263a9bef06ec9a486 (patch) | |
tree | 63f4106441053a06868aab1c5a5e6d13c42a4b4f /src/basic/memory-util.c | |
parent | f977356a82822612d82a8b4507b5140a7a6ffc40 (diff) | |
download | systemd-3f92dc2fd4070b213e6bc85263a9bef06ec9a486.tar.gz |
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.
Diffstat (limited to 'src/basic/memory-util.c')
-rw-r--r-- | src/basic/memory-util.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/basic/memory-util.c b/src/basic/memory-util.c index 2983762117..c4f54c7b4e 100644 --- a/src/basic/memory-util.c +++ b/src/basic/memory-util.c @@ -38,21 +38,3 @@ bool memeqbyte(uint8_t byte, const void *data, size_t length) { /* Now we know first 16 bytes match, memcmp() with self. */ return memcmp(data, p + 16, length) == 0; } - -#if !HAVE_EXPLICIT_BZERO -/* - * The pointer to memset() is volatile so that compiler must de-reference the pointer and can't assume that - * it points to any function in particular (such as memset(), which it then might further "optimize"). This - * approach is inspired by openssl's crypto/mem_clr.c. - */ -typedef void *(*memset_t)(void *,int,size_t); - -static volatile memset_t memset_func = memset; - -void* explicit_bzero_safe(void *p, size_t l) { - if (l > 0) - memset_func(p, '\0', l); - - return p; -} -#endif |