X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=dc35b4d9801466fb0d992f45f28828d78a36940f;hb=5ecb28f69ef670c7e194b656b57fda6f8850f0ba;hp=99a138cd8e16c017a63d2da631f56f6780d272ab;hpb=1ca208fb4f93e5869704af1812cbff7130a2fc03;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index 99a138cd8..dc35b4d98 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -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) @@ -764,6 +765,8 @@ void parse_user_at_host(char *arg, char **user, char **host); int split_pair(const char *s, const char *sep, char **l, char **r); +bool restore_state(void); + /** * Normal qsort requires base to be nonnull. Here were require * that only if nmemb > 0.