mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-06 21:51:37 +00:00
Move DEFINE_TRIVIAL_CLEANUP_FUNC to macro.h
This remove the need for various header files to include the (relatively heavyweight) util.h.
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include <libudev.h>
|
||||
#include <stdlib.h>
|
||||
#include "grdev.h"
|
||||
#include "hashmap.h"
|
||||
#include "idev.h"
|
||||
#include "list.h"
|
||||
#include "macro.h"
|
||||
@@ -36,7 +35,6 @@
|
||||
#include "sysview.h"
|
||||
#include "term.h"
|
||||
#include "unifont.h"
|
||||
#include "util.h"
|
||||
|
||||
typedef struct Manager Manager;
|
||||
typedef struct Session Session;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
***/
|
||||
|
||||
#include "sd-event.h"
|
||||
#include "util.h"
|
||||
#include "macro.h"
|
||||
|
||||
typedef struct RawImport RawImport;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "sparse-endian.h"
|
||||
#include "journal-def.h"
|
||||
#include "util.h"
|
||||
#include "macro.h"
|
||||
#include "mmap-cache.h"
|
||||
#include "hashmap.h"
|
||||
|
||||
|
||||
@@ -446,4 +446,11 @@ do { \
|
||||
#define GID_INVALID ((gid_t) -1)
|
||||
#define MODE_INVALID ((mode_t) -1)
|
||||
|
||||
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
|
||||
static inline void func##p(type *p) { \
|
||||
if (*p) \
|
||||
func(*p); \
|
||||
} \
|
||||
struct __useless_struct_to_allow_trailing_semicolon__
|
||||
|
||||
#include "log.h"
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
***/
|
||||
|
||||
#include "hashmap.h"
|
||||
#include "util.h"
|
||||
#include "macro.h"
|
||||
|
||||
Set *internal_set_new(const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS);
|
||||
#define set_new(ops) internal_set_new(ops HASHMAP_DEBUG_SRC_ARGS)
|
||||
|
||||
@@ -664,13 +664,6 @@ static inline void freep(void *p) {
|
||||
free(*(void**) p);
|
||||
}
|
||||
|
||||
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
|
||||
static inline void func##p(type *p) { \
|
||||
if (*p) \
|
||||
func(*p); \
|
||||
} \
|
||||
struct __useless_struct_to_allow_trailing_semicolon__
|
||||
|
||||
static inline void closep(int *fd) {
|
||||
safe_close(*fd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user