mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
basic: Remove circular dep between alloc-util.h and memory-util.h
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
void* memdup(const void *p, size_t l) {
|
||||
void *ret;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "assert-util.h"
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
#if HAS_FEATURE_MEMORY_SANITIZER
|
||||
# include <sanitizer/msan_interface.h>
|
||||
@@ -267,5 +268,3 @@ _alloc_(2) static inline void *realloc0(void *p, size_t new_size) {
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
#include "memory-util.h"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "keyring-util.h"
|
||||
#include "log.h"
|
||||
#include "alloc-util.h"
|
||||
#include "memory-util.h"
|
||||
#include "missing_syscall.h"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <threads.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "memory-util.h"
|
||||
|
||||
size_t page_size(void) {
|
||||
@@ -55,3 +56,14 @@ void* memdup_reverse(const void *mem, size_t size) {
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "macro.h"
|
||||
#include "memory-util-fundamental.h"
|
||||
|
||||
@@ -98,16 +97,7 @@ static inline void* mempmem_safe(const void *haystack, size_t haystacklen, const
|
||||
return (uint8_t*) p + needlelen;
|
||||
}
|
||||
|
||||
static inline 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);
|
||||
}
|
||||
void* erase_and_free(void *p);
|
||||
|
||||
static inline void erase_and_freep(void *p) {
|
||||
erase_and_free(*(void**) p);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "sd-json.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "cryptsetup-token.h"
|
||||
#include "cryptsetup-token-util.h"
|
||||
#include "hexdecoct.h"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "memory-util.h"
|
||||
#include "random-util.h"
|
||||
#include "recovery-key.h"
|
||||
|
||||
Reference in New Issue
Block a user