X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=eee66ccf647bfcde0c34db9c9d41cffe2c1c9fc3;hb=a432cb691ca3c1e18b012cb8e9f6e5654b3652a2;hp=c0398f1aeca0c57745d7e2287ee2b9c7a6429ebd;hpb=b231b54780dfa687fc116ed436790c87d5557188;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index c0398f1ae..eee66ccf6 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -361,8 +361,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); -int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...); +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_welcome(void); int fd_columns(int fd); @@ -500,7 +500,7 @@ char *format_bytes(char *buf, size_t l, off_t t); int fd_wait_for_event(int fd, int event, usec_t timeout); -void* memdup(const void *p, size_t l); +void* memdup(const void *p, size_t l) _alloc_(2); int is_kernel_thread(pid_t pid); @@ -560,14 +560,14 @@ static inline void umaskp(mode_t *u) { #define _cleanup_umask_ _cleanup_(umaskp) #define _cleanup_globfree_ _cleanup_(globfree) -_malloc_ static inline void *malloc_multiply(size_t a, size_t b) { +_malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) { if (_unlikely_(b == 0 || a > ((size_t) -1) / b)) return NULL; return malloc(a * b); } - static inline void *memdup_multiply(const void *p, size_t a, size_t b) { +_alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_t b) { if (_unlikely_(b == 0 || a > ((size_t) -1) / b)) return NULL; @@ -633,7 +633,7 @@ static inline void *mempset(void *s, int c, size_t n) { char *hexmem(const void *p, size_t l); void *unhexmem(const char *p, size_t l); -char *strextend(char **x, ...); +char *strextend(char **x, ...) _sentinel_; char *strrep(const char *s, unsigned n); void* greedy_realloc(void **p, size_t *allocated, size_t need); @@ -644,7 +644,7 @@ static inline void _reset_errno_(int *saved_errno) { errno = *saved_errno; } -#define PROTECT_ERRNO _cleanup_(_reset_errno_) int _saved_errno_ = errno +#define PROTECT_ERRNO _cleanup_(_reset_errno_) __attribute__((unused)) int _saved_errno_ = errno struct _umask_struct_ { mode_t mask; @@ -733,3 +733,5 @@ static inline void _reset_locale_(struct _locale_struct_ *s) { } \ !_saved_locale_.quit; }) ; \ _saved_locale_.quit = true) + +bool id128_is_valid(const char *s);