Files
systemd/src/basic/memory-util.c
T
Yu Watanabe 75bc106095 memory-util: drop unused memdup_reverse()
With the previous commit, now the function is unused anymore.
Let's drop it.
2026-07-03 03:02:56 +09:00

32 lines
584 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <threads.h>
#include <unistd.h>
#include "alloc-util.h"
#include "memory-util.h"
size_t page_size(void) {
static thread_local size_t pgsz = 0;
if (_likely_(pgsz > 0))
return pgsz;
long p = sysconf(_SC_PAGESIZE);
assert(p > 0);
pgsz = (size_t) p;
return pgsz;
}
void* erase_and_free(void *p) {
size_t l;
if (!p)
return NULL;
l = MALLOC_SIZEOF_SAFE(p);
explicit_bzero_safe(p, l);
return mfree(p);
}