chiark / gitweb /
Prep v229: Add missing fixes from upstream [6/6] src/systemd
[elogind.git] / src / systemd / _sd-common.h
index 896a027eb5027a32f1d28a629455518fce60b3d6..2d4e1f26e1ebfe92c55fb56af52573f7fd221127 100644 (file)
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
 #ifndef foosdcommonhfoo
 #define foosdcommonhfoo
 
 #  ifdef __cplusplus
 #    define _SD_BEGIN_DECLARATIONS                              \
         extern "C" {                                            \
-        struct __useless_struct_to_allow_trailing_semicolon__
+        struct _sd_useless_struct_to_allow_trailing_semicolon_
 #  else
 #    define _SD_BEGIN_DECLARATIONS                              \
-        struct __useless_struct_to_allow_trailing_semicolon__
+        struct _sd_useless_struct_to_allow_trailing_semicolon_
 #  endif
 #endif
 
 #  ifdef __cplusplus
 #    define _SD_END_DECLARATIONS                                \
         }                                                       \
-        struct __useless_struct_to_allow_trailing_semicolon__
+        struct _sd_useless_cpp_struct_to_allow_trailing_semicolon_
 #  else
 #    define _SD_END_DECLARATIONS                                \
-        struct __useless_struct_to_allow_trailing_semicolon__
+        struct _sd_useless_struct_to_allow_trailing_semicolon_
 #  endif
 #endif
 
+#define _SD_DEFINE_POINTER_CLEANUP_FUNC(type, func)             \
+        static inline void func##p(type **p) {                  \
+                if (*p)                                         \
+                        func(*p);                               \
+        }                                                       \
+        struct _sd_useless_struct_to_allow_trailing_semicolon_
+
 #endif