Bugprone argument comment 8 (#37678)
Follow up from https://github.com/systemd/systemd/pull/37556
This commit is contained in:
@@ -688,7 +688,7 @@ static int strv_env_get_n_validated(
|
||||
|
||||
int replace_env_full(
|
||||
const char *format,
|
||||
size_t n,
|
||||
size_t length,
|
||||
char **env,
|
||||
ReplaceEnvFlags flags,
|
||||
char **ret,
|
||||
@@ -714,13 +714,13 @@ int replace_env_full(
|
||||
|
||||
assert(format);
|
||||
|
||||
if (n == SIZE_MAX)
|
||||
n = strlen(format);
|
||||
if (length == SIZE_MAX)
|
||||
length = strlen(format);
|
||||
|
||||
pu = ret_unset_variables ? &unset_variables : NULL;
|
||||
pb = ret_bad_variables ? &bad_variables : NULL;
|
||||
|
||||
for (e = format, i = 0; *e && i < n; e++, i++)
|
||||
for (e = format, i = 0; *e && i < length; e++, i++)
|
||||
switch (state) {
|
||||
|
||||
case WORD:
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef enum ReplaceEnvFlags {
|
||||
REPLACE_ENV_ALLOW_EXTENDED = 1 << 2,
|
||||
} ReplaceEnvFlags;
|
||||
|
||||
int replace_env_full(const char *format, size_t n, char **env, ReplaceEnvFlags flags, char **ret, char ***ret_unset_variables, char ***ret_bad_variables);
|
||||
int replace_env_full(const char *format, size_t length, char **env, ReplaceEnvFlags flags, char **ret, char ***ret_unset_variables, char ***ret_bad_variables);
|
||||
static inline int replace_env(const char *format, char **env, ReplaceEnvFlags flags, char **ret) {
|
||||
return replace_env_full(format, SIZE_MAX, env, flags, ret, NULL, NULL);
|
||||
}
|
||||
|
||||
+5
-5
@@ -188,10 +188,10 @@ int pipe_eof(int fd) {
|
||||
return !!(r & POLLHUP);
|
||||
}
|
||||
|
||||
int ppoll_usec_full(struct pollfd *fds, size_t nfds, usec_t timeout, const sigset_t *ss) {
|
||||
int ppoll_usec_full(struct pollfd *fds, size_t n_fds, usec_t timeout, const sigset_t *ss) {
|
||||
int r;
|
||||
|
||||
assert(fds || nfds == 0);
|
||||
assert(fds || n_fds == 0);
|
||||
|
||||
/* This is a wrapper around ppoll() that does primarily two things:
|
||||
*
|
||||
@@ -208,16 +208,16 @@ int ppoll_usec_full(struct pollfd *fds, size_t nfds, usec_t timeout, const sigse
|
||||
* to handle signals, such as signalfd() or signal handlers. ⚠️ ⚠️ ⚠️
|
||||
*/
|
||||
|
||||
if (nfds == 0 && timeout == 0)
|
||||
if (n_fds == 0 && timeout == 0)
|
||||
return 0;
|
||||
|
||||
r = ppoll(fds, nfds, timeout == USEC_INFINITY ? NULL : TIMESPEC_STORE(timeout), ss);
|
||||
r = ppoll(fds, n_fds, timeout == USEC_INFINITY ? NULL : TIMESPEC_STORE(timeout), ss);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
if (r == 0)
|
||||
return 0;
|
||||
|
||||
for (size_t i = 0, n = r; i < nfds && n > 0; i++) {
|
||||
for (size_t i = 0, n = r; i < n_fds && n > 0; i++) {
|
||||
if (fds[i].revents == 0)
|
||||
continue;
|
||||
if (fds[i].revents & POLLNVAL)
|
||||
|
||||
+3
-3
@@ -15,9 +15,9 @@ static inline int loop_write(int fd, const void *buf, size_t nbytes) {
|
||||
|
||||
int pipe_eof(int fd);
|
||||
|
||||
int ppoll_usec_full(struct pollfd *fds, size_t nfds, usec_t timeout, const sigset_t *ss) _nonnull_if_nonzero_(1, 2);
|
||||
_nonnull_if_nonzero_(1, 2) static inline int ppoll_usec(struct pollfd *fds, size_t nfds, usec_t timeout) {
|
||||
return ppoll_usec_full(fds, nfds, timeout, NULL);
|
||||
int ppoll_usec_full(struct pollfd *fds, size_t n_fds, usec_t timeout, const sigset_t *ss) _nonnull_if_nonzero_(1, 2);
|
||||
_nonnull_if_nonzero_(1, 2) static inline int ppoll_usec(struct pollfd *fds, size_t n_fds, usec_t timeout) {
|
||||
return ppoll_usec_full(fds, n_fds, timeout, NULL);
|
||||
}
|
||||
|
||||
int fd_wait_for_event(int fd, int event, usec_t timeout);
|
||||
|
||||
@@ -735,7 +735,7 @@ int acquire_terminal(
|
||||
.fd = notify,
|
||||
.events = POLLIN,
|
||||
},
|
||||
/* n_pollfds = */ 1,
|
||||
/* n_fds = */ 1,
|
||||
left,
|
||||
&poll_ss);
|
||||
if (r < 0)
|
||||
|
||||
@@ -367,7 +367,7 @@ int uid_map_search_root(pid_t pid, UIDRangeUsernsMode mode, uid_t *ret) {
|
||||
for (;;) {
|
||||
uid_t uid_base = UID_INVALID, uid_shift = UID_INVALID;
|
||||
|
||||
r = uid_map_read_one(f, &uid_base, &uid_shift, /* ret_uid_range= */ NULL);
|
||||
r = uid_map_read_one(f, &uid_base, &uid_shift, /* ret_range= */ NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -2706,7 +2706,7 @@ _public_ int sd_journal_get_realtime_usec(sd_journal *j, uint64_t *ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id128_t *ret_boot_id) {
|
||||
_public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret_monotonic, sd_id128_t *ret_boot_id) {
|
||||
JournalFile *f;
|
||||
Object *o;
|
||||
int r;
|
||||
@@ -2739,8 +2739,8 @@ _public_ int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id12
|
||||
if (!VALID_MONOTONIC(t))
|
||||
return -EBADMSG;
|
||||
|
||||
if (ret)
|
||||
*ret = t;
|
||||
if (ret_monotonic)
|
||||
*ret_monotonic = t;
|
||||
if (ret_boot_id)
|
||||
*ret_boot_id = o->entry.boot_id;
|
||||
|
||||
|
||||
+2
-2
@@ -3757,7 +3757,7 @@ static int setup_unix_export_dir_outside(char **ret) {
|
||||
* itself is writable, but not through the mount accessible from the host. */
|
||||
r = mount_nofollow_verbose(
|
||||
LOG_ERR,
|
||||
/* source= */ NULL,
|
||||
/* what= */ NULL,
|
||||
w,
|
||||
/* fstype= */ NULL,
|
||||
MS_BIND|MS_REMOUNT|MS_RDONLY|MS_NODEV|MS_NOEXEC|MS_NOSUID|ms_nosymfollow_supported(),
|
||||
@@ -3802,7 +3802,7 @@ static int setup_unix_export_host_inside(const char *directory, const char *unix
|
||||
|
||||
r = mount_nofollow_verbose(
|
||||
LOG_ERR,
|
||||
/* source= */ NULL,
|
||||
/* what= */ NULL,
|
||||
p,
|
||||
/* fstype= */ NULL,
|
||||
MS_BIND|MS_REMOUNT|MS_NODEV|MS_NOEXEC|MS_NOSUID|ms_nosymfollow_supported(),
|
||||
|
||||
@@ -112,7 +112,7 @@ int unit_file_reenable(
|
||||
size_t *n_changes);
|
||||
int unit_file_preset(
|
||||
RuntimeScope scope,
|
||||
UnitFileFlags flags,
|
||||
UnitFileFlags file_flags,
|
||||
const char *root_dir,
|
||||
char * const *names,
|
||||
UnitFilePresetMode mode,
|
||||
@@ -120,7 +120,7 @@ int unit_file_preset(
|
||||
size_t *n_changes);
|
||||
int unit_file_preset_all(
|
||||
RuntimeScope scope,
|
||||
UnitFileFlags flags,
|
||||
UnitFileFlags file_flags,
|
||||
const char *root_dir,
|
||||
UnitFilePresetMode mode,
|
||||
InstallChange **changes,
|
||||
|
||||
@@ -1983,7 +1983,7 @@ int path_is_network_fs_harder_at(int dir_fd, const char *path) {
|
||||
return r;
|
||||
|
||||
_cleanup_free_ char *fstype = NULL, *options = NULL;
|
||||
r = path_get_mount_info_at(fd, /* path = */ NULL, &fstype, &options, /* source = */ NULL);
|
||||
r = path_get_mount_info_at(fd, /* path = */ NULL, &fstype, &options, /* ret_source = */ NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ int sd_journal_previous_skip(sd_journal *j, uint64_t skip);
|
||||
int sd_journal_next_skip(sd_journal *j, uint64_t skip);
|
||||
|
||||
int sd_journal_get_realtime_usec(sd_journal *j, uint64_t *ret);
|
||||
int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret, sd_id128_t *ret_boot_id);
|
||||
int sd_journal_get_monotonic_usec(sd_journal *j, uint64_t *ret_monotonic, sd_id128_t *ret_boot_id);
|
||||
int sd_journal_get_seqnum(sd_journal *j, uint64_t *ret_seqnum, sd_id128_t *ret_seqnum_id);
|
||||
|
||||
int sd_journal_set_data_threshold(sd_journal *j, size_t sz);
|
||||
|
||||
@@ -239,7 +239,7 @@ int sd_varlink_server_listen_fd(sd_varlink_server *s, int fd);
|
||||
int sd_varlink_server_listen_auto(sd_varlink_server *s);
|
||||
int sd_varlink_server_listen_name(sd_varlink_server *s, const char *name);
|
||||
int sd_varlink_server_add_connection(sd_varlink_server *s, int fd, sd_varlink **ret);
|
||||
int sd_varlink_server_add_connection_pair(sd_varlink_server *s, int input_fd, int output_fd, const struct ucred *ucred_override, sd_varlink **ret);
|
||||
int sd_varlink_server_add_connection_pair(sd_varlink_server *s, int input_fd, int output_fd, const struct ucred *override_ucred, sd_varlink **ret);
|
||||
int sd_varlink_server_add_connection_stdio(sd_varlink_server *s, sd_varlink **ret);
|
||||
|
||||
/* Bind callbacks */
|
||||
|
||||
Reference in New Issue
Block a user