X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fmacro.h;h=96d96f962116d0fdcce5c264a57e1c874c0d5fbe;hp=daa42c4c68101ce5e70fb773a7fafd5937c417e8;hb=a2341f6836da0a217ab0c5f2b82f0c4ea13d429d;hpb=2695c5c44e028d1bc07404baf3357e5a6017fc57;ds=sidebyside diff --git a/src/shared/macro.h b/src/shared/macro.h index daa42c4c6..96d96f962 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.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"