tree-wide: Fix declaration/definition parameter name mismatches
This commit is contained in:
committed by
Yu Watanabe
parent
a8374a7607
commit
6a9f0641cd
@@ -1628,18 +1628,18 @@ int cg_mask_to_string(CGroupMask mask, char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cg_mask_from_string(const char *value, CGroupMask *ret) {
|
||||
int cg_mask_from_string(const char *s, CGroupMask *ret) {
|
||||
CGroupMask m = 0;
|
||||
|
||||
assert(ret);
|
||||
assert(value);
|
||||
assert(s);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *n = NULL;
|
||||
CGroupController v;
|
||||
int r;
|
||||
|
||||
r = extract_first_word(&value, &n, NULL, 0);
|
||||
r = extract_first_word(&s, &n, NULL, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
|
||||
+25
-23
@@ -27,31 +27,33 @@ typedef void* (*mfree_func_t)(void *p);
|
||||
0; \
|
||||
})
|
||||
|
||||
#define _DEFINE_TRIVIAL_REF_FUNC(type, name, scope) \
|
||||
scope type *name##_ref(type *p) { \
|
||||
if (!p) \
|
||||
return NULL; \
|
||||
\
|
||||
/* For type check. */ \
|
||||
unsigned *q = &p->n_ref; \
|
||||
assert(*q > 0); \
|
||||
assert_se(*q < UINT_MAX); \
|
||||
\
|
||||
(*q)++; \
|
||||
return p; \
|
||||
#define _DEFINE_TRIVIAL_REF_FUNC(type, name, scope) \
|
||||
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
|
||||
scope type *name##_ref(type *p) { \
|
||||
if (!p) \
|
||||
return NULL; \
|
||||
\
|
||||
/* For type check. */ \
|
||||
unsigned *q = &p->n_ref; \
|
||||
assert(*q > 0); \
|
||||
assert_se(*q < UINT_MAX); \
|
||||
\
|
||||
(*q)++; \
|
||||
return p; \
|
||||
}
|
||||
|
||||
#define _DEFINE_TRIVIAL_UNREF_FUNC(type, name, free_func, scope) \
|
||||
scope type *name##_unref(type *p) { \
|
||||
if (!p) \
|
||||
return NULL; \
|
||||
\
|
||||
assert(p->n_ref > 0); \
|
||||
p->n_ref--; \
|
||||
if (p->n_ref > 0) \
|
||||
return NULL; \
|
||||
\
|
||||
return free_func(p); \
|
||||
#define _DEFINE_TRIVIAL_UNREF_FUNC(type, name, free_func, scope) \
|
||||
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
|
||||
scope type *name##_unref(type *p) { \
|
||||
if (!p) \
|
||||
return NULL; \
|
||||
\
|
||||
assert(p->n_ref > 0); \
|
||||
p->n_ref--; \
|
||||
if (p->n_ref > 0) \
|
||||
return NULL; \
|
||||
\
|
||||
return free_func(p); \
|
||||
}
|
||||
|
||||
#define DEFINE_TRIVIAL_REF_FUNC(type, name) \
|
||||
|
||||
@@ -1029,7 +1029,7 @@ int decompress_stream_xz(int fdf, int fdt, uint64_t max_bytes) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int decompress_stream_lz4(int in, int out, uint64_t max_bytes) {
|
||||
int decompress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) {
|
||||
#if HAVE_LZ4
|
||||
size_t c;
|
||||
_cleanup_(LZ4F_freeDecompressionContextp) LZ4F_decompressionContext_t ctx = NULL;
|
||||
@@ -1047,7 +1047,7 @@ int decompress_stream_lz4(int in, int out, uint64_t max_bytes) {
|
||||
if (sym_LZ4F_isError(c))
|
||||
return -ENOMEM;
|
||||
|
||||
if (fstat(in, &st) < 0)
|
||||
if (fstat(fdf, &st) < 0)
|
||||
return log_debug_errno(errno, "fstat() failed: %m");
|
||||
|
||||
if (file_offset_beyond_memory_size(st.st_size))
|
||||
@@ -1057,7 +1057,7 @@ int decompress_stream_lz4(int in, int out, uint64_t max_bytes) {
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
src = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, in, 0);
|
||||
src = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fdf, 0);
|
||||
if (src == MAP_FAILED)
|
||||
return -errno;
|
||||
|
||||
@@ -1080,7 +1080,7 @@ int decompress_stream_lz4(int in, int out, uint64_t max_bytes) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
r = loop_write(out, buf, produced);
|
||||
r = loop_write(fdt, buf, produced);
|
||||
if (r < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ typedef enum Compression {
|
||||
} Compression;
|
||||
|
||||
const char* compression_to_string(Compression compression) _const_;
|
||||
Compression compression_from_string(const char *compression) _pure_;
|
||||
Compression compression_from_string(const char *s) _pure_;
|
||||
const char* compression_lowercase_to_string(Compression compression) _const_;
|
||||
Compression compression_lowercase_from_string(const char *compression) _pure_;
|
||||
Compression compression_lowercase_from_string(const char *s) _pure_;
|
||||
|
||||
bool compression_supported(Compression c);
|
||||
|
||||
@@ -58,9 +58,9 @@ int compress_stream_xz(int fdf, int fdt, uint64_t max_bytes, uint64_t *ret_uncom
|
||||
int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes, uint64_t *ret_uncompressed_size);
|
||||
int compress_stream_zstd(int fdf, int fdt, uint64_t max_bytes, uint64_t *ret_uncompressed_size);
|
||||
|
||||
int decompress_stream_xz(int fdf, int fdt, uint64_t max_size);
|
||||
int decompress_stream_lz4(int fdf, int fdt, uint64_t max_size);
|
||||
int decompress_stream_zstd(int fdf, int fdt, uint64_t max_size);
|
||||
int decompress_stream_xz(int fdf, int fdt, uint64_t max_bytes);
|
||||
int decompress_stream_lz4(int fdf, int fdt, uint64_t max_bytes);
|
||||
int decompress_stream_zstd(int fdf, int fdt, uint64_t max_bytes);
|
||||
|
||||
int dlopen_lz4(void);
|
||||
int dlopen_zstd(void);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ int efi_get_variable(const char *variable, uint32_t *attribute, void **ret_value
|
||||
int efi_get_variable_string(const char *variable, char **ret);
|
||||
int efi_get_variable_path(const char *variable, char **ret);
|
||||
int efi_set_variable(const char *variable, const void *value, size_t size) _nonnull_if_nonzero_(2, 3);
|
||||
int efi_set_variable_string(const char *variable, const char *p);
|
||||
int efi_set_variable_string(const char *variable, const char *value);
|
||||
|
||||
bool is_efi_boot(void);
|
||||
bool is_efi_secure_boot(void);
|
||||
|
||||
@@ -605,10 +605,10 @@ int strv_env_get_merged(char **l, char ***ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char** strv_env_clean_with_callback(char **e, void (*invalid_callback)(const char *p, void *userdata), void *userdata) {
|
||||
char** strv_env_clean_with_callback(char **l, void (*invalid_callback)(const char *p, void *userdata), void *userdata) {
|
||||
int k = 0;
|
||||
|
||||
STRV_FOREACH(p, e) {
|
||||
STRV_FOREACH(p, l) {
|
||||
size_t n;
|
||||
bool duplicate = false;
|
||||
|
||||
@@ -631,13 +631,13 @@ char** strv_env_clean_with_callback(char **e, void (*invalid_callback)(const cha
|
||||
continue;
|
||||
}
|
||||
|
||||
e[k++] = *p;
|
||||
l[k++] = *p;
|
||||
}
|
||||
|
||||
if (e)
|
||||
e[k] = NULL;
|
||||
if (l)
|
||||
l[k] = NULL;
|
||||
|
||||
return e;
|
||||
return l;
|
||||
}
|
||||
|
||||
static int strv_extend_with_length(char ***l, const char *s, size_t n) {
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ void close_many_and_free(int *fds, size_t n_fds);
|
||||
|
||||
int fclose_nointr(FILE *f);
|
||||
FILE* safe_fclose(FILE *f);
|
||||
DIR* safe_closedir(DIR *f);
|
||||
DIR* safe_closedir(DIR *d);
|
||||
|
||||
static inline void closep(int *fd) {
|
||||
safe_close(*fd);
|
||||
|
||||
+4
-4
@@ -528,7 +528,7 @@ int mknodat_atomic(int atfd, const char *path, mode_t mode, dev_t dev) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mkfifoat_atomic(int atfd, const char *path, mode_t mode) {
|
||||
int mkfifoat_atomic(int dir_fd, const char *path, mode_t mode) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
int r;
|
||||
|
||||
@@ -539,12 +539,12 @@ int mkfifoat_atomic(int atfd, const char *path, mode_t mode) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (mkfifoat(atfd, t, mode) < 0)
|
||||
if (mkfifoat(dir_fd, t, mode) < 0)
|
||||
return -errno;
|
||||
|
||||
r = RET_NERRNO(renameat(atfd, t, atfd, path));
|
||||
r = RET_NERRNO(renameat(dir_fd, t, dir_fd, path));
|
||||
if (r < 0) {
|
||||
(void) unlinkat(atfd, t, 0);
|
||||
(void) unlinkat(dir_fd, t, 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ DEFINE_HASH_OPS_FULL(
|
||||
char, string_hash_func, string_compare_func, free,
|
||||
char*, strv_free);
|
||||
|
||||
void path_hash_func(const char *q, struct siphash *state) {
|
||||
void path_hash_func(const char *p, struct siphash *state) {
|
||||
bool add_slash = false;
|
||||
|
||||
assert(q);
|
||||
assert(p);
|
||||
assert(state);
|
||||
|
||||
/* Calculates a hash for a path in a way this duplicate inner slashes don't make a differences, and also
|
||||
@@ -43,14 +43,14 @@ void path_hash_func(const char *q, struct siphash *state) {
|
||||
* which begin in a slash or not) will hash differently though. */
|
||||
|
||||
/* if path is absolute, add one "/" to the hash. */
|
||||
if (path_is_absolute(q))
|
||||
if (path_is_absolute(p))
|
||||
siphash24_compress_byte('/', state);
|
||||
|
||||
for (;;) {
|
||||
const char *e;
|
||||
int r;
|
||||
|
||||
r = path_find_first_component(&q, true, &e);
|
||||
r = path_find_first_component(&p, true, &e);
|
||||
if (r == 0)
|
||||
return;
|
||||
|
||||
@@ -59,7 +59,7 @@ void path_hash_func(const char *q, struct siphash *state) {
|
||||
|
||||
if (r < 0) {
|
||||
/* if a component is invalid, then add remaining part as a string. */
|
||||
string_hash_func(q, state);
|
||||
string_hash_func(p, state);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -1372,7 +1372,7 @@ void* _hashmap_get(HashmapBase *h, const void *key) {
|
||||
return entry_value(h, e);
|
||||
}
|
||||
|
||||
void* hashmap_get2(Hashmap *h, const void *key, void **key2) {
|
||||
void* hashmap_get2(Hashmap *h, const void *key, void **ret) {
|
||||
struct plain_hashmap_entry *e;
|
||||
unsigned hash, idx;
|
||||
|
||||
@@ -1385,8 +1385,8 @@ void* hashmap_get2(Hashmap *h, const void *key, void **key2) {
|
||||
return NULL;
|
||||
|
||||
e = plain_bucket_at(h, idx);
|
||||
if (key2)
|
||||
*key2 = (void*) e->b.key;
|
||||
if (ret)
|
||||
*ret = (void*) e->b.key;
|
||||
|
||||
return e->value;
|
||||
}
|
||||
@@ -1421,29 +1421,29 @@ void* _hashmap_remove(HashmapBase *h, const void *key) {
|
||||
return data;
|
||||
}
|
||||
|
||||
void* hashmap_remove2(Hashmap *h, const void *key, void **rkey) {
|
||||
void* hashmap_remove2(Hashmap *h, const void *key, void **ret) {
|
||||
struct plain_hashmap_entry *e;
|
||||
unsigned hash, idx;
|
||||
void *data;
|
||||
|
||||
if (!h) {
|
||||
if (rkey)
|
||||
*rkey = NULL;
|
||||
if (ret)
|
||||
*ret = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hash = bucket_hash(h, key);
|
||||
idx = bucket_scan(h, hash, key);
|
||||
if (idx == IDX_NIL) {
|
||||
if (rkey)
|
||||
*rkey = NULL;
|
||||
if (ret)
|
||||
*ret = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
e = plain_bucket_at(h, idx);
|
||||
data = e->value;
|
||||
if (rkey)
|
||||
*rkey = (void*) e->b.key;
|
||||
if (ret)
|
||||
*ret = (void*) e->b.key;
|
||||
|
||||
remove_entry(h, idx);
|
||||
|
||||
|
||||
+6
-6
@@ -123,9 +123,9 @@ static inline void *ordered_hashmap_get(OrderedHashmap *h, const void *key) {
|
||||
return _hashmap_get(HASHMAP_BASE(h), key);
|
||||
}
|
||||
|
||||
void* hashmap_get2(Hashmap *h, const void *key, void **rkey);
|
||||
static inline void *ordered_hashmap_get2(OrderedHashmap *h, const void *key, void **rkey) {
|
||||
return hashmap_get2(PLAIN_HASHMAP(h), key, rkey);
|
||||
void* hashmap_get2(Hashmap *h, const void *key, void **ret);
|
||||
static inline void *ordered_hashmap_get2(OrderedHashmap *h, const void *key, void **ret) {
|
||||
return hashmap_get2(PLAIN_HASHMAP(h), key, ret);
|
||||
}
|
||||
|
||||
bool _hashmap_contains(HashmapBase *h, const void *key);
|
||||
@@ -144,9 +144,9 @@ static inline void *ordered_hashmap_remove(OrderedHashmap *h, const void *key) {
|
||||
return _hashmap_remove(HASHMAP_BASE(h), key);
|
||||
}
|
||||
|
||||
void* hashmap_remove2(Hashmap *h, const void *key, void **rkey);
|
||||
static inline void *ordered_hashmap_remove2(OrderedHashmap *h, const void *key, void **rkey) {
|
||||
return hashmap_remove2(PLAIN_HASHMAP(h), key, rkey);
|
||||
void* hashmap_remove2(Hashmap *h, const void *key, void **ret);
|
||||
static inline void *ordered_hashmap_remove2(OrderedHashmap *h, const void *key, void **ret) {
|
||||
return hashmap_remove2(PLAIN_HASHMAP(h), key, ret);
|
||||
}
|
||||
|
||||
void* _hashmap_remove_value(HashmapBase *h, const void *key, void *value);
|
||||
|
||||
@@ -112,7 +112,7 @@ int unhexmem_full(
|
||||
size_t l,
|
||||
bool secure,
|
||||
void **ret_data,
|
||||
size_t *ret_len) {
|
||||
size_t *ret_size) {
|
||||
|
||||
_cleanup_free_ uint8_t *buf = NULL;
|
||||
size_t buf_size;
|
||||
@@ -150,8 +150,8 @@ int unhexmem_full(
|
||||
|
||||
*z = 0;
|
||||
|
||||
if (ret_len)
|
||||
*ret_len = (size_t) (z - buf);
|
||||
if (ret_size)
|
||||
*ret_size = (size_t) (z - buf);
|
||||
if (ret_data)
|
||||
*ret_data = TAKE_PTR(buf);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ ssize_t base64_append(
|
||||
size_t plen,
|
||||
const void *p,
|
||||
size_t l,
|
||||
size_t margin,
|
||||
size_t indent,
|
||||
size_t width);
|
||||
int unbase64mem_full(const char *p, size_t l, bool secure, void **ret_data, size_t *ret_size) _nonnull_if_nonzero_(1, 2);
|
||||
static inline int unbase64mem(const char *p, void **ret_data, size_t *ret_size) {
|
||||
|
||||
@@ -27,7 +27,7 @@ typedef enum LocaleVariable {
|
||||
_VARIABLE_LC_INVALID = -EINVAL,
|
||||
} LocaleVariable;
|
||||
|
||||
int get_locales(char ***l);
|
||||
int get_locales(char ***ret);
|
||||
bool locale_is_valid(const char *name);
|
||||
int locale_is_installed(const char *name);
|
||||
|
||||
|
||||
@@ -34,5 +34,5 @@ static inline int strv_from_nulstr(char ***ret, const char *nulstr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int strv_make_nulstr(char * const *l, char **p, size_t *n);
|
||||
int strv_make_nulstr(char * const *l, char **ret, size_t *ret_size);
|
||||
int set_make_nulstr(Set *s, char **ret, size_t *ret_size);
|
||||
|
||||
@@ -685,10 +685,10 @@ int parse_fractional_part_u(const char **p, size_t digits, unsigned *res) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_nice(const char *p, int *ret) {
|
||||
int parse_nice(const char *s, int *ret) {
|
||||
int n, r;
|
||||
|
||||
r = safe_atoi(p, &n);
|
||||
r = safe_atoi(s, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ int parse_errno(const char *t);
|
||||
int parse_fd(const char *t);
|
||||
int parse_user_shell(const char *s, char **ret_sh, bool *ret_copy);
|
||||
|
||||
int parse_capability_set(const char *s, uint64_t initial, uint64_t *capability_set);
|
||||
int parse_capability_set(const char *s, uint64_t initial, uint64_t *current);
|
||||
|
||||
#define SAFE_ATO_REFUSE_PLUS_MINUS (1U << 30)
|
||||
#define SAFE_ATO_REFUSE_LEADING_ZERO (1U << 29)
|
||||
@@ -38,7 +38,7 @@ static inline int safe_atou(const char *s, unsigned *ret_u) {
|
||||
int safe_atou_bounded(const char *s, unsigned min, unsigned max, unsigned *ret);
|
||||
|
||||
int safe_atoi(const char *s, int *ret_i);
|
||||
int safe_atolli(const char *s, long long *ret_i);
|
||||
int safe_atolli(const char *s, long long *ret_lli);
|
||||
|
||||
int safe_atou8_full(const char *s, unsigned base, uint8_t *ret);
|
||||
|
||||
@@ -131,9 +131,9 @@ static inline int safe_atozu(const char *s, size_t *ret_u) {
|
||||
|
||||
int safe_atod(const char *s, double *ret_d);
|
||||
|
||||
int parse_fractional_part_u(const char **s, size_t digits, unsigned *res);
|
||||
int parse_fractional_part_u(const char **p, size_t digits, unsigned *res);
|
||||
|
||||
int parse_nice(const char *p, int *ret);
|
||||
int parse_nice(const char *s, int *ret);
|
||||
|
||||
int parse_ip_port(const char *s, uint16_t *ret);
|
||||
int parse_ip_port_range(const char *s, uint16_t *low, uint16_t *high, bool allow_zero);
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ int pidref_kill(const PidRef *pidref, int sig);
|
||||
int pidref_kill_and_sigcont(const PidRef *pidref, int sig);
|
||||
int pidref_sigqueue(const PidRef *pidref, int sig, int value);
|
||||
|
||||
int pidref_wait(PidRef *pidref, siginfo_t *siginfo, int options);
|
||||
int pidref_wait(PidRef *pidref, siginfo_t *ret, int options);
|
||||
int pidref_wait_for_terminate(PidRef *pidref, siginfo_t *ret);
|
||||
|
||||
static inline void pidref_done_sigkill_wait(PidRef *pidref) {
|
||||
|
||||
@@ -19,7 +19,7 @@ int proc_cmdline_strv(char ***ret);
|
||||
|
||||
int proc_cmdline_parse(proc_cmdline_parse_t parse, void *userdata, ProcCmdlineFlags flags);
|
||||
|
||||
int proc_cmdline_get_key(const char *parameter, ProcCmdlineFlags flags, char **ret_value);
|
||||
int proc_cmdline_get_key(const char *key, ProcCmdlineFlags flags, char **ret_value);
|
||||
int proc_cmdline_get_bool(const char *key, ProcCmdlineFlags flags, bool *ret);
|
||||
|
||||
int proc_cmdline_get_key_many_internal(ProcCmdlineFlags flags, ...);
|
||||
|
||||
@@ -86,7 +86,7 @@ int kill_and_sigcont(pid_t pid, int sig);
|
||||
int pid_is_kernel_thread(pid_t pid);
|
||||
int pidref_is_kernel_thread(const PidRef *pid);
|
||||
|
||||
int getenv_for_pid(pid_t pid, const char *field, char **_value);
|
||||
int getenv_for_pid(pid_t pid, const char *field, char **ret);
|
||||
|
||||
int pid_is_alive(pid_t pid);
|
||||
int pidref_is_alive(const PidRef *pidref);
|
||||
@@ -121,7 +121,7 @@ int opinionated_personality(unsigned long *ret);
|
||||
const char* sigchld_code_to_string(int i) _const_;
|
||||
int sigchld_code_from_string(const char *s) _pure_;
|
||||
|
||||
int sched_policy_to_string_alloc(int i, char **s);
|
||||
int sched_policy_to_string_alloc(int i, char **ret);
|
||||
int sched_policy_from_string(const char *s);
|
||||
|
||||
static inline pid_t PTR_TO_PID(const void *p) {
|
||||
|
||||
@@ -16,4 +16,4 @@ static inline int procfs_memory_get_used(uint64_t *ret) {
|
||||
return procfs_memory_get(NULL, ret);
|
||||
}
|
||||
|
||||
int convert_meminfo_value_to_uint64_bytes(const char *word, uint64_t *ret);
|
||||
int convert_meminfo_value_to_uint64_bytes(const char *s, uint64_t *ret);
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@
|
||||
|
||||
int sha256_fd(int fd, uint64_t max_size, uint8_t ret[static SHA256_DIGEST_SIZE]);
|
||||
|
||||
int parse_sha256(const char *s, uint8_t res[static SHA256_DIGEST_SIZE]);
|
||||
int parse_sha256(const char *s, uint8_t ret[static SHA256_DIGEST_SIZE]);
|
||||
|
||||
bool sha256_is_valid(const char *s) _pure_;
|
||||
|
||||
@@ -89,7 +89,7 @@ int sigset_add_many_internal(sigset_t *ss, ...) {
|
||||
return r;
|
||||
}
|
||||
|
||||
int sigprocmask_many_internal(int how, sigset_t *old, ...) {
|
||||
int sigprocmask_many_internal(int how, sigset_t *ret_old_mask, ...) {
|
||||
va_list ap;
|
||||
sigset_t ss;
|
||||
int r;
|
||||
@@ -97,14 +97,14 @@ int sigprocmask_many_internal(int how, sigset_t *old, ...) {
|
||||
if (sigemptyset(&ss) < 0)
|
||||
return -errno;
|
||||
|
||||
va_start(ap, old);
|
||||
va_start(ap, ret_old_mask);
|
||||
r = sigset_add_many_ap(&ss, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return RET_NERRNO(sigprocmask(how, &ss, old));
|
||||
return RET_NERRNO(sigprocmask(how, &ss, ret_old_mask));
|
||||
}
|
||||
|
||||
static const char *const static_signal_table[] = {
|
||||
|
||||
@@ -31,7 +31,7 @@ int sigset_add_many_internal(sigset_t *ss, ...);
|
||||
int sigprocmask_many_internal(int how, sigset_t *ret_old_mask, ...);
|
||||
#define sigprocmask_many(...) sigprocmask_many_internal(__VA_ARGS__, -1)
|
||||
|
||||
const char* signal_to_string(int i) _const_;
|
||||
const char* signal_to_string(int signo) _const_;
|
||||
int signal_from_string(const char *s) _pure_;
|
||||
|
||||
void nop_signal_handler(int sig);
|
||||
|
||||
@@ -67,7 +67,7 @@ static inline int socket_address_unlink(const SocketAddress *a) {
|
||||
bool socket_address_can_accept(const SocketAddress *a) _pure_;
|
||||
|
||||
int socket_address_verify(const SocketAddress *a, bool strict) _pure_;
|
||||
int socket_address_print(const SocketAddress *a, char **p);
|
||||
int socket_address_print(const SocketAddress *a, char **ret);
|
||||
bool socket_address_matches_fd(const SocketAddress *a, int fd);
|
||||
|
||||
bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) _pure_;
|
||||
@@ -87,7 +87,7 @@ int getsockname_pretty(int fd, char **ret);
|
||||
|
||||
int socknameinfo_pretty(const struct sockaddr *sa, socklen_t salen, char **_ret);
|
||||
|
||||
int netlink_family_to_string_alloc(int b, char **s);
|
||||
int netlink_family_to_string_alloc(int i, char **ret);
|
||||
int netlink_family_from_string(const char *s) _pure_;
|
||||
|
||||
bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b);
|
||||
@@ -101,7 +101,7 @@ static inline int fd_increase_rxbuf(int fd, size_t n) {
|
||||
return fd_set_rcvbuf(fd, n, true);
|
||||
}
|
||||
|
||||
int ip_tos_to_string_alloc(int i, char **s);
|
||||
int ip_tos_to_string_alloc(int i, char **ret);
|
||||
int ip_tos_from_string(const char *s);
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -14,9 +14,10 @@ int string_table_lookup_to_string_fallback(const char * const *table, size_t len
|
||||
ssize_t string_table_lookup_from_string_fallback(const char * const *table, size_t len, const char *s, size_t max);
|
||||
|
||||
/* For basic lookup tables with strictly enumerated entries */
|
||||
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name, type, scope) \
|
||||
scope const char* name##_to_string(type i) { \
|
||||
return string_table_lookup_to_string(name##_table, ELEMENTSOF(name##_table), i); \
|
||||
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name, type, scope) \
|
||||
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
|
||||
scope const char* name##_to_string(type i) { \
|
||||
return string_table_lookup_to_string(name##_table, ELEMENTSOF(name##_table), i); \
|
||||
}
|
||||
|
||||
#define _DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(name, type, scope) \
|
||||
@@ -29,8 +30,9 @@ ssize_t string_table_lookup_from_string_fallback(const char * const *table, size
|
||||
return (type) string_table_lookup_from_string_with_boolean(name##_table, ELEMENTSOF(name##_table), s, yes); \
|
||||
}
|
||||
|
||||
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name, type, max, scope) \
|
||||
scope int name##_to_string_alloc(type i, char **ret) { \
|
||||
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING_FALLBACK(name, type, max, scope) \
|
||||
/* NOLINTNEXTLINE (readability-inconsistent-declaration-parameter-name) */ \
|
||||
scope int name##_to_string_alloc(type i, char **ret) { \
|
||||
return string_table_lookup_to_string_fallback(name##_table, ELEMENTSOF(name##_table), i, max, ret); \
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -144,32 +144,32 @@ char ascii_toupper(char x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
char* ascii_strlower(char *t) {
|
||||
assert(t);
|
||||
char* ascii_strlower(char *s) {
|
||||
assert(s);
|
||||
|
||||
for (char *p = t; *p; p++)
|
||||
for (char *p = s; *p; p++)
|
||||
*p = ascii_tolower(*p);
|
||||
|
||||
return t;
|
||||
return s;
|
||||
}
|
||||
|
||||
char* ascii_strupper(char *t) {
|
||||
assert(t);
|
||||
char* ascii_strupper(char *s) {
|
||||
assert(s);
|
||||
|
||||
for (char *p = t; *p; p++)
|
||||
for (char *p = s; *p; p++)
|
||||
*p = ascii_toupper(*p);
|
||||
|
||||
return t;
|
||||
return s;
|
||||
}
|
||||
|
||||
char* ascii_strlower_n(char *t, size_t n) {
|
||||
char* ascii_strlower_n(char *s, size_t n) {
|
||||
if (n <= 0)
|
||||
return t;
|
||||
return s;
|
||||
|
||||
for (size_t i = 0; i < n; i++)
|
||||
t[i] = ascii_tolower(t[i]);
|
||||
s[i] = ascii_tolower(s[i]);
|
||||
|
||||
return t;
|
||||
return s;
|
||||
}
|
||||
|
||||
int ascii_strcasecmp_n(const char *a, const char *b, size_t n) {
|
||||
|
||||
+5
-5
@@ -159,17 +159,17 @@ void strv_free_many(char ***strvs, size_t n) {
|
||||
free(strvs);
|
||||
}
|
||||
|
||||
char** strv_copy_n(char * const *l, size_t m) {
|
||||
char** strv_copy_n(char * const *l, size_t n) {
|
||||
_cleanup_strv_free_ char **result = NULL;
|
||||
char **k;
|
||||
|
||||
result = new(char*, MIN(strv_length(l), m) + 1);
|
||||
result = new(char*, MIN(strv_length(l), n) + 1);
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
k = result;
|
||||
STRV_FOREACH(i, l) {
|
||||
if (m == 0)
|
||||
if (n == 0)
|
||||
break;
|
||||
|
||||
*k = strdup(*i);
|
||||
@@ -177,8 +177,8 @@ char** strv_copy_n(char * const *l, size_t m) {
|
||||
return NULL;
|
||||
k++;
|
||||
|
||||
if (m != SIZE_MAX)
|
||||
m--;
|
||||
if (n != SIZE_MAX)
|
||||
n--;
|
||||
}
|
||||
|
||||
*k = NULL;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "stdio-util.h"
|
||||
|
||||
char* sysctl_normalize(char *s);
|
||||
int sysctl_read(const char *property, char **value);
|
||||
int sysctl_read(const char *property, char **ret);
|
||||
int sysctl_write_full(const char *property, const char *value, Hashmap **shadow);
|
||||
int sysctl_writef(const char *property, const char *format, ...) _printf_(2, 3);
|
||||
static inline int sysctl_write(const char *property, const char *value) {
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
#include "basic-forward.h"
|
||||
|
||||
int log_facility_unshifted_to_string_alloc(int i, char **s);
|
||||
int log_facility_unshifted_to_string_alloc(int i, char **ret);
|
||||
int log_facility_unshifted_from_string(const char *s);
|
||||
bool log_facility_unshifted_is_valid(int faciliy);
|
||||
|
||||
int log_level_to_string_alloc(int i, char **s);
|
||||
int log_level_to_string_alloc(int i, char **ret);
|
||||
int log_level_from_string(const char *s);
|
||||
bool log_level_is_valid(int level);
|
||||
|
||||
|
||||
@@ -86,16 +86,16 @@ int proc_cmdline_tty_size(const char *tty, unsigned *ret_rows, unsigned *ret_col
|
||||
int chvt(int vt);
|
||||
|
||||
int read_one_char(FILE *f, char *ret, usec_t timeout, bool echo, bool *need_nl);
|
||||
int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
|
||||
int ask_char(char *ret, const char *replies, const char *fmt, ...) _printf_(3, 4);
|
||||
|
||||
typedef int (*GetCompletionsCallback)(const char *key, char ***ret_list, void *userdata);
|
||||
int ask_string_full(char **ret, GetCompletionsCallback cb, void *userdata, const char *text, ...) _printf_(4, 5);
|
||||
int ask_string_full(char **ret, GetCompletionsCallback get_completions, void *userdata, const char *text, ...) _printf_(4, 5);
|
||||
#define ask_string(ret, text, ...) ask_string_full(ret, NULL, NULL, text, ##__VA_ARGS__)
|
||||
|
||||
bool any_key_to_proceed(void);
|
||||
int show_menu(char **x, size_t n_columns, size_t column_width, unsigned ellipsize_percentage, const char *grey_prefix, bool with_numbers);
|
||||
|
||||
int vt_disallocate(const char *name);
|
||||
int vt_disallocate(const char *tty_path);
|
||||
|
||||
int resolve_dev_console(char **ret);
|
||||
int get_kernel_consoles(char ***ret);
|
||||
|
||||
@@ -325,7 +325,7 @@ UnitActiveState unit_active_state_from_string(const char *s) _pure_;
|
||||
|
||||
const char* freezer_state_to_string(FreezerState i) _const_;
|
||||
FreezerState freezer_state_from_string(const char *s) _pure_;
|
||||
FreezerState freezer_state_finish(FreezerState i) _const_;
|
||||
FreezerState freezer_state_finish(FreezerState state) _const_;
|
||||
FreezerState freezer_state_objective(FreezerState state) _const_;
|
||||
|
||||
const char* unit_marker_to_string(UnitMarker m) _const_;
|
||||
|
||||
@@ -67,7 +67,7 @@ static inline int unit_name_mangle(const char *name, UnitNameMangle flags, char
|
||||
}
|
||||
|
||||
int slice_build_parent_slice(const char *slice, char **ret);
|
||||
int slice_build_subslice(const char *slice, const char *name, char **subslice);
|
||||
int slice_build_subslice(const char *slice, const char *name, char **ret);
|
||||
bool slice_name_is_valid(const char *name);
|
||||
|
||||
bool unit_name_prefix_equal(const char *a, const char *b);
|
||||
|
||||
@@ -71,7 +71,7 @@ char* gid_to_name(gid_t gid);
|
||||
int in_gid(gid_t gid);
|
||||
int in_group(const char *name);
|
||||
|
||||
int merge_gid_lists(const gid_t *list1, size_t size1, const gid_t *list2, size_t size2, gid_t **result);
|
||||
int merge_gid_lists(const gid_t *list1, size_t size1, const gid_t *list2, size_t size2, gid_t **ret);
|
||||
int getgroups_alloc(gid_t **ret);
|
||||
|
||||
int get_home_dir(char **ret);
|
||||
|
||||
Reference in New Issue
Block a user