X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsystemd%2F_sd-common.h;h=2d4e1f26e1ebfe92c55fb56af52573f7fd221127;hb=51e8372fb6cca277dc7afc6e83f48a1a2b6d4dbe;hp=896a027eb5027a32f1d28a629455518fce60b3d6;hpb=10b17992ee59ac1d03d6fc210a976bc2b59f6d75;p=elogind.git diff --git a/src/systemd/_sd-common.h b/src/systemd/_sd-common.h index 896a027eb..2d4e1f26e 100644 --- a/src/systemd/_sd-common.h +++ b/src/systemd/_sd-common.h @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - #ifndef foosdcommonhfoo #define foosdcommonhfoo @@ -57,10 +55,10 @@ # 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 @@ -68,11 +66,18 @@ # 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