chiark / gitweb /
TODO: add some fsck items
[elogind.git] / src / shared / util.h
index 99a138cd8e16c017a63d2da631f56f6780d272ab..63cb4ac636967adc8bb8101c725ae4c597a9f60b 100644 (file)
@@ -320,7 +320,7 @@ bool fstype_is_network(const char *fstype);
 int chvt(int vt);
 
 int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
-int ask(char *ret, const char *replies, const char *text, ...) _printf_attr_(3, 4);
+int ask(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
 
 int reset_terminal_fd(int fd, bool switch_to_text);
 int reset_terminal(const char *name);
@@ -374,8 +374,8 @@ int pipe_eof(int fd);
 
 cpu_set_t* cpu_set_malloc(unsigned *ncpus);
 
-int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) _printf_attr_(4,0);
-int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...) _printf_attr_(4,5);
+int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) _printf_(4,0);
+int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...) _printf_(4,5);
 int status_welcome(void);
 
 int fd_columns(int fd);
@@ -556,11 +556,12 @@ 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);                       \
-        }                                       \
+#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) {
         if (*fd >= 0)
@@ -571,10 +572,10 @@ static inline void umaskp(mode_t *u) {
         umask(*u);
 }
 
-define_trivial_cleanup_func(FILE*, fclose)
-define_trivial_cleanup_func(FILE*, pclose)
-define_trivial_cleanup_func(DIR*, closedir)
-define_trivial_cleanup_func(FILE*, endmntent)
+DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, fclose);
+DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, pclose);
+DEFINE_TRIVIAL_CLEANUP_FUNC(DIR*, closedir);
+DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
 
 #define _cleanup_free_ _cleanup_(freep)
 #define _cleanup_close_ _cleanup_(closep)