diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/set.c | 8 | ||||
-rw-r--r-- | src/shared/set.h | 10 | ||||
-rw-r--r-- | src/shared/strv.c | 4 | ||||
-rw-r--r-- | src/shared/strv.h | 5 | ||||
-rw-r--r-- | src/shared/util.c | 8 | ||||
-rw-r--r-- | src/shared/util.h | 9 |
6 files changed, 19 insertions, 25 deletions
diff --git a/src/shared/set.c b/src/shared/set.c index 111d53bb36..5f83c50839 100644 --- a/src/shared/set.c +++ b/src/shared/set.c @@ -37,18 +37,10 @@ void set_free(Set* s) { hashmap_free(MAKE_HASHMAP(s)); } -void set_freep(Set **s) { - set_free(*s); -} - void set_free_free(Set *s) { hashmap_free_free(MAKE_HASHMAP(s)); } -void set_free_freep(Set **s) { - set_free_free(*s); -} - int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func) { return hashmap_ensure_allocated((Hashmap**) s, hash_func, compare_func); } diff --git a/src/shared/set.h b/src/shared/set.h index 2f792585fa..38c4b58a80 100644 --- a/src/shared/set.h +++ b/src/shared/set.h @@ -33,9 +33,15 @@ typedef struct Set Set; Set *set_new(hash_func_t hash_func, compare_func_t compare_func); void set_free(Set* s); -void set_freep(Set **s); +static inline void set_freep(Set **s) { + set_free(*s); +} + void set_free_free(Set *s); -void set_free_freep(Set **s); +static inline void set_free_freep(Set **s) { + set_free_free(*s); +} + Set* set_copy(Set *s); int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func); diff --git a/src/shared/strv.c b/src/shared/strv.c index 117382ed80..7bcfabbf1a 100644 --- a/src/shared/strv.c +++ b/src/shared/strv.c @@ -64,10 +64,6 @@ void strv_free(char **l) { free(l); } -void strv_freep(char ***l) { - strv_free(*l); -} - char **strv_copy(char **l) { char **r, **k; diff --git a/src/shared/strv.h b/src/shared/strv.h index 623f10216d..da9fae6edb 100644 --- a/src/shared/strv.h +++ b/src/shared/strv.h @@ -30,7 +30,10 @@ char *strv_find(char **l, const char *name); char *strv_find_prefix(char **l, const char *name); void strv_free(char **l); -void strv_freep(char ***l); +static inline void strv_freep(char ***l) { + strv_free(*l); +} + char **strv_copy(char **l) _malloc_; unsigned strv_length(char **l); diff --git a/src/shared/util.c b/src/shared/util.c index c493a34877..594f8de755 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -5237,10 +5237,6 @@ int get_shell(char **_sh) { return 0; } -void freep(void *p) { - free(*(void**) p); -} - void fclosep(FILE **f) { if (*f) fclose(*f); @@ -5261,10 +5257,6 @@ void closedirp(DIR **d) { closedir(*d); } -void umaskp(mode_t *u) { - umask(*u); -} - bool filename_is_safe(const char *p) { if (isempty(p)) diff --git a/src/shared/util.h b/src/shared/util.h index 27b21f97cc..04c9fcd71e 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -519,12 +519,17 @@ void warn_melody(void); int get_shell(char **ret); int get_home_dir(char **ret); -void freep(void *p); +static inline void freep(void *p) { + free(*(void**) p); +} + void fclosep(FILE **f); void pclosep(FILE **f); void closep(int *fd); void closedirp(DIR **d); -void umaskp(mode_t *u); +static inline void umaskp(mode_t *u) { + umask(*u); +} _malloc_ static inline void *malloc_multiply(size_t a, size_t b) { if (_unlikely_(b == 0 || a > ((size_t) -1) / b)) |