1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

tree-wide: drop space between variable and an increment/decrement

This commit is contained in:
Yu Watanabe 2023-12-25 01:41:11 +09:00
parent 1d03d970a1
commit b3a9d980f3
48 changed files with 68 additions and 68 deletions

View File

@ -683,7 +683,7 @@ int replace_env_full(
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 < n; e++, i++)
switch (state) {
case WORD:

View File

@ -156,7 +156,7 @@ int fsck_exists_for_fstype(const char *fstype);
char *_p, *_n; \
size_t _l; \
while (_path[0] == '/' && _path[1] == '/') \
_path ++; \
_path++; \
if (isempty(_root)) \
_ret = _path; \
else { \

View File

@ -547,7 +547,7 @@ int sockaddr_pretty(
} else {
if (path[path_len - 1] == '\0')
/* We expect a terminating NUL and don't print it */
path_len --;
path_len--;
p = cescape_length(path, path_len);
}

View File

@ -324,7 +324,7 @@ static int parse_argv(int argc, char *argv[]) {
break;
case 'R':
arg_print_root_device ++;
arg_print_root_device++;
break;
case ARG_NO_VARIABLES:

View File

@ -87,7 +87,7 @@ int bus_job_method_get_waiting_jobs(sd_bus_message *message, void *userdata, sd_
if (r < 0)
return r;
for (int i = 0; i < n; i ++) {
for (int i = 0; i < n; i++) {
_cleanup_free_ char *unit_path = NULL, *job_path = NULL;
job_path = job_dbus_path(list[i]);

View File

@ -1469,7 +1469,7 @@ static int follow_symlink(
mount_entry_consume_prefix(m, TAKE_PTR(target));
m->n_followed ++;
m->n_followed++;
return 0;
}
@ -2625,7 +2625,7 @@ int bind_mount_add(BindMount **b, size_t *n, const BindMount *item) {
*b = c;
c[(*n) ++] = (BindMount) {
c[(*n)++] = (BindMount) {
.source = TAKE_PTR(s),
.destination = TAKE_PTR(d),
.read_only = item->read_only,
@ -2694,7 +2694,7 @@ int mount_image_add(MountImage **m, size_t *n, const MountImage *item) {
*m = c;
c[(*n) ++] = (MountImage) {
c[(*n)++] = (MountImage) {
.source = TAKE_PTR(s),
.destination = TAKE_PTR(d),
.mount_options = TAKE_PTR(options),
@ -2745,7 +2745,7 @@ int temporary_filesystem_add(
*t = c;
c[(*n) ++] = (TemporaryFileSystem) {
c[(*n)++] = (TemporaryFileSystem) {
.path = TAKE_PTR(p),
.options = TAKE_PTR(o),
};

View File

@ -90,7 +90,7 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) {
/* If this is a symlink watch both the symlink inode and where it points to. If the inode is
* not a symlink both calls will install the same watch, which is redundant and doesn't
* hurt. */
for (int follow_symlink = 0; follow_symlink < 2; follow_symlink ++) {
for (int follow_symlink = 0; follow_symlink < 2; follow_symlink++) {
uint32_t f = flags;
SET_FLAG(f, IN_DONT_FOLLOW, !follow_symlink);

View File

@ -2529,7 +2529,7 @@ static void service_enter_restart(Service *s) {
/* Count the jobs we enqueue for restarting. This counter is maintained as long as the unit isn't
* fully stopped, i.e. as long as it remains up or remains in auto-start states. The user can reset
* the counter explicitly however via the usual "systemctl reset-failure" logic. */
s->n_restarts ++;
s->n_restarts++;
s->flush_n_restarts = false;
s->notify_access_override = _NOTIFY_ACCESS_INVALID;

View File

@ -2314,7 +2314,7 @@ void unit_start_on_failure(
log_unit_warning_errno(
u, r, "Failed to enqueue %s job, ignoring: %s",
dependency_name, bus_error_message(&error, r));
n_jobs ++;
n_jobs++;
}
if (n_jobs >= 0)

View File

@ -25,7 +25,7 @@ static int search_policy_hash(
if (hash_size == 0)
return 0;
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token ++) {
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
_cleanup_free_ void *thash = NULL;
size_t thash_size = 0;

View File

@ -571,7 +571,7 @@ static int check_for_homed(struct crypt_device *cd) {
/* Politely refuse operating on homed volumes. The enrolled tokens for the user record and the LUKS2
* volume should not get out of sync. */
for (int token = 0; token < crypt_token_max(CRYPT_LUKS2); token ++) {
for (int token = 0; token < crypt_token_max(CRYPT_LUKS2); token++) {
r = cryptsetup_get_token_as_json(cd, token, "systemd-homed", NULL);
if (IN_SET(r, -ENOENT, -EINVAL, -EMEDIUMTYPE))
continue;

View File

@ -314,7 +314,7 @@ static int enumerate_dir(
dirs[n_dirs] = strdup(de->d_name);
if (!dirs[n_dirs])
return -ENOMEM;
n_dirs ++;
n_dirs++;
}
if (!dirent_is_file(de))
@ -326,7 +326,7 @@ static int enumerate_dir(
files[n_files] = strdup(de->d_name);
if (!files[n_files])
return -ENOMEM;
n_files ++;
n_files++;
}
strv_sort(dirs);

View File

@ -166,7 +166,7 @@ static int show_menu(char **x, unsigned n_columns, unsigned width, unsigned perc
for (i = 0; i < per_column; i++) {
for (j = 0; j < n_columns; j ++) {
for (j = 0; j < n_columns; j++) {
_cleanup_free_ char *e = NULL;
if (j * per_column + i >= n)

View File

@ -136,11 +136,11 @@ int user_record_verify(UserRecord *ur, EVP_PKEY *public_key) {
return -EIO;
if (EVP_DigestVerify(md_ctx, signature, signature_size, (uint8_t*) text, strlen(text)) <= 0) {
n_bad ++;
n_bad++;
continue;
}
n_good ++;
n_good++;
}
return n_good > 0 ? (n_bad == 0 ? USER_RECORD_SIGNED_EXCLUSIVE : USER_RECORD_SIGNED) :

View File

@ -273,7 +273,7 @@ int qcow2_convert(int qcow2_fd, int raw_fd) {
if ((uint64_t) l != sz)
return -EIO;
for (i = 0; i < HEADER_L1_SIZE(&header); i ++) {
for (i = 0; i < HEADER_L1_SIZE(&header); i++) {
uint64_t l2_begin, j;
r = normalize_offset(&header, l1_table[i], &l2_begin, NULL, NULL);

View File

@ -612,7 +612,7 @@ static void client_context_try_shrink_to(Server *s, size_t limit) {
if (pid_is_unwaited(c->pid) == 0)
client_context_free(s, c);
else
idx ++;
idx++;
}
s->last_cache_pid_flush = t;

View File

@ -283,7 +283,7 @@ static int parse_options(const uint8_t options[], size_t buflen, uint8_t *overlo
int r;
while (offset < buflen) {
code = options[offset ++];
code = options[offset++];
switch (code) {
case SD_DHCP_OPTION_PAD:
@ -296,7 +296,7 @@ static int parse_options(const uint8_t options[], size_t buflen, uint8_t *overlo
if (buflen < offset + 1)
return -ENOBUFS;
len = options[offset ++];
len = options[offset++];
if (buflen < offset + len)
return -EINVAL;

View File

@ -731,7 +731,7 @@ static int parse_caps(sd_bus_creds *c, unsigned offset, const char *p) {
return -ENOMEM;
}
for (i = 0; i < sz; i ++) {
for (i = 0; i < sz; i++) {
uint32_t v = 0;
for (j = 0; j < 8; ++j) {

View File

@ -76,7 +76,7 @@ _public_ int sd_listen_fds(int unset_environment) {
goto finish;
}
for (int fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++) {
for (int fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd++) {
r = fd_cloexec(fd, true);
if (r < 0)
goto finish;

View File

@ -2488,7 +2488,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
/* drop trailing newlines */
while (len > 0 && strchr(NEWLINE, _value[len - 1]))
len --;
len--;
/* value length is limited to 4k */
if (len > 4096)

View File

@ -1165,10 +1165,10 @@ static int source_set_pending(sd_event_source *s, bool b) {
assert(s->inotify.inode_data->inotify_data);
if (b)
s->inotify.inode_data->inotify_data->n_pending ++;
s->inotify.inode_data->inotify_data->n_pending++;
else {
assert(s->inotify.inode_data->inotify_data->n_pending > 0);
s->inotify.inode_data->inotify_data->n_pending --;
s->inotify.inode_data->inotify_data->n_pending--;
}
}
@ -4000,7 +4000,7 @@ static int process_inotify(sd_event *e) {
if (r < 0)
return r;
if (r > 0)
done ++;
done++;
}
return done;

View File

@ -2740,7 +2740,7 @@ static int parse_argv(int argc, char *argv[]) {
/* If we already found the "shell" verb on the command line, and now found the next
* non-option argument, then this is the machine name and we should stop processing
* further arguments. */
optind --; /* don't process this argument, go one step back */
optind--; /* don't process this argument, go one step back */
goto done;
}
if (streq(optarg, "shell"))

View File

@ -423,7 +423,7 @@ static int dhcp4_server_configure(Link *link) {
return log_link_warning_errno(link, r, "Failed to %s Rapid Commit support for DHCPv4 server instance: %m",
enable_disable(link->network->dhcp_server_rapid_commit));
for (sd_dhcp_lease_server_type_t type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type ++) {
for (sd_dhcp_lease_server_type_t type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type++) {
if (!link->network->dhcp_server_emit[type].emit)
continue;

View File

@ -153,7 +153,7 @@ static int find_free_uid(const char *directory, uid_t max_uid, uid_t *current_ui
assert(directory);
assert(current_uid);
for (;; (*current_uid) ++) {
for (;; (*current_uid)++) {
if (*current_uid > MAP_UID_MAX || *current_uid > max_uid)
return log_error_errno(
SYNTHETIC_ERRNO(EBUSY),

View File

@ -2082,7 +2082,7 @@ static int oci_hooks_array(const char *name, JsonVariant *v, JsonDispatchFlags f
return r;
}
(*n_array) ++;
(*n_array)++;
}
return 0;

View File

@ -4455,7 +4455,7 @@ static int merge_settings(Settings *settings, const char *path) {
#endif
}
for (rl = 0; rl < _RLIMIT_MAX; rl ++) {
for (rl = 0; rl < _RLIMIT_MAX; rl++) {
if ((arg_settings_mask & (SETTING_RLIMIT_FIRST << rl)))
continue;

View File

@ -489,7 +489,7 @@ static int dns_transaction_pick_server(DnsTransaction *t) {
dns_server_unref(t->server);
t->server = dns_server_ref(server);
t->n_picked_servers ++;
t->n_picked_servers++;
log_debug("Using DNS server %s for transaction %u.", strna(dns_server_string_full(t->server)), t->id);

View File

@ -163,9 +163,9 @@ bool bitmap_iterate(const Bitmap *b, Iterator *i, unsigned *n) {
rem = BITMAP_NUM_TO_REM(i->idx);
bitmask = UINT64_C(1) << rem;
for (; offset < b->n_bitmaps; offset ++) {
for (; offset < b->n_bitmaps; offset++) {
if (b->bitmaps[offset]) {
for (; bitmask; bitmask <<= 1, rem ++) {
for (; bitmask; bitmask <<= 1, rem++) {
if (b->bitmaps[offset] & bitmask) {
*n = BITMAP_OFFSET_TO_NUM(offset, rem);
i->idx = *n + 1;

View File

@ -40,7 +40,7 @@ CompareOperator parse_compare_operator(const char **s, CompareOperatorParseFlags
* parse_compare_operator() are use on the same string? */
return _COMPARE_OPERATOR_INVALID;
for (size_t i = 0; i < ELEMENTSOF(table); i ++) {
for (size_t i = 0; i < ELEMENTSOF(table); i++) {
const char *e;
if (table[i].need_mask != 0 && !FLAGS_SET(flags, table[i].need_mask))

View File

@ -150,7 +150,7 @@ int acquire_fido2_key_auto(
/* Loads FIDO2 metadata from LUKS2 JSON token headers. */
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token ++) {
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
JsonVariant *w;
_cleanup_free_ void *salt = NULL;

View File

@ -3396,7 +3396,7 @@ int dissected_image_acquire_metadata(DissectedImage *m, DissectImageFlags extra_
assert(m);
for (; n_meta_initialized < _META_MAX; n_meta_initialized ++) {
for (; n_meta_initialized < _META_MAX; n_meta_initialized++) {
assert(paths[n_meta_initialized]);
if (pipe2(fds + 2*n_meta_initialized, O_CLOEXEC) < 0) {

View File

@ -246,7 +246,7 @@ int fdset_new_listen_fds(FDSet **ret, bool unset) {
return -ENOMEM;
n = sd_listen_fds(unset);
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++) {
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd++) {
r = fdset_put(s, fd);
if (r < 0)
return r;

View File

@ -2632,7 +2632,7 @@ int table_print(Table *t, FILE *f) {
}
fputc('\n', f);
n_subline ++;
n_subline++;
} while (more_sublines);
}

View File

@ -226,9 +226,9 @@ int fstab_filter_options(
if (IN_SET(*end, ',', '\0'))
break;
assert(*end == '\\');
end ++; /* Skip the backslash */
end++; /* Skip the backslash */
if (*end != '\0')
end ++; /* Skip the escaped char, but watch out for a trailing comma */
end++; /* Skip the escaped char, but watch out for a trailing comma */
}
NULSTR_FOREACH(name, names) {

View File

@ -484,7 +484,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
if (r == 0)
break;
line_number ++;
line_number++;
/* comment line */
if (line[0] == '#')

View File

@ -1810,7 +1810,7 @@ int unit_file_verify_alias(
_cleanup_free_ char *dir = NULL;
char *p;
path_alias ++; /* skip over slash */
path_alias++; /* skip over slash */
r = path_extract_directory(dst, &dir);
if (r < 0)

View File

@ -559,7 +559,7 @@ static int _json_variant_array_put_element(JsonVariant *array, JsonVariant *elem
return -ELNRNG;
if (d >= array->depth)
array->depth = d + 1;
array->n_elements ++;
array->n_elements++;
*w = (JsonVariant) {
.is_embedded = true,
@ -2310,7 +2310,7 @@ static int json_variant_copy(JsonVariant **nv, JsonVariant *v) {
source = json_variant_string(v);
k = strnlen(source, INLINE_STRING_MAX + 1);
if (k <= INLINE_STRING_MAX) {
k ++;
k++;
break;
}
@ -2594,7 +2594,7 @@ static int json_parse_string(const char **p, char **ret) {
return -ENOMEM;
s[n++] = ch;
c ++;
c++;
continue;
}
@ -4574,7 +4574,7 @@ int json_dispatch_full(
}
}
done ++;
done++;
} else { /* Didn't find a matching entry! ☹️ */
@ -4589,7 +4589,7 @@ int json_dispatch_full(
return r;
} else
done ++;
done++;
} else {
json_log(value, flags, 0, "Unexpected object field '%s'.", json_variant_string(key));

View File

@ -60,7 +60,7 @@ static int start_loopback(sd_netlink *rtnl, struct state *s) {
if (r < 0)
return r;
s->n_messages ++;
s->n_messages++;
return 0;
}
@ -95,7 +95,7 @@ static int add_ipv4_address(sd_netlink *rtnl, struct state *s) {
if (r < 0)
return r;
s->n_messages ++;
s->n_messages++;
return 0;
}
@ -136,7 +136,7 @@ static int add_ipv6_address(sd_netlink *rtnl, struct state *s) {
if (r < 0)
return r;
s->n_messages ++;
s->n_messages++;
return 0;
}

View File

@ -135,7 +135,7 @@ bool mount_point_is_api(const char *path) {
/* Checks if this mount point is considered "API", and hence
* should be ignored */
for (size_t i = 0; i < ELEMENTSOF(mount_table); i ++)
for (size_t i = 0; i < ELEMENTSOF(mount_table); i++)
if (path_equal(path, mount_table[i].where))
return true;

View File

@ -326,7 +326,7 @@ static int rm_rf_children_impl(
dirname = mfree(dirname);
/* And now let's back out one level up */
n_todo --;
n_todo--;
d = TAKE_PTR(todos[n_todo].dir);
dirname = TAKE_PTR(todos[n_todo].dirname);
old_mode = todos[n_todo].old_mode;

View File

@ -401,7 +401,7 @@ static int varlink_interface_realloc(VarlinkInterface **interface, size_t n_symb
assert(interface);
n_symbols ++; /* Space for trailing NULL end marker symbol */
n_symbols++; /* Space for trailing NULL end marker symbol */
/* Overflow check */
if (n_symbols > (SIZE_MAX - offsetof(VarlinkInterface, symbols)) / sizeof(VarlinkSymbol*))
@ -420,7 +420,7 @@ static int varlink_symbol_realloc(VarlinkSymbol **symbol, size_t n_fields) {
assert(symbol);
n_fields ++; /* Space for trailing end marker field */
n_fields++; /* Space for trailing end marker field */
/* Overflow check */
if (n_fields > (SIZE_MAX - offsetof(VarlinkSymbol, fields)) / sizeof(VarlinkField))

View File

@ -132,7 +132,7 @@ static int dm_points_list_detach(DeviceMapper **head, bool *changed, bool last_t
if ((major(rootdev) != 0 && rootdev == m->devnum) ||
(major(usrdev) != 0 && usrdev == m->devnum)) {
log_debug("Not detaching DM %s that backs the OS itself, skipping.", m->path);
n_failed ++;
n_failed++;
continue;
}

View File

@ -153,7 +153,7 @@ static int md_points_list_detach(RaidDevice **head, bool *changed, bool last_try
if ((major(rootdev) != 0 && rootdev == m->devnum) ||
(major(usrdev) != 0 && usrdev == m->devnum)) {
log_debug("Not detaching MD %s that backs the OS itself, skipping.", m->path);
n_failed ++;
n_failed++;
continue;
}

View File

@ -854,7 +854,7 @@ static int merge_subprocess(
if (r < 0)
return log_oom();
n_extensions ++;
n_extensions++;
}
/* Nothing left? Then shortcut things */

View File

@ -807,7 +807,7 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
return r;
STRV_FOREACH(p, sysvrcnd_path)
for (unsigned i = 0; i < ELEMENTSOF(rcnd_table); i ++) {
for (unsigned i = 0; i < ELEMENTSOF(rcnd_table); i++) {
_cleanup_closedir_ DIR *d = NULL;
_cleanup_free_ char *path = NULL;

View File

@ -11,7 +11,7 @@ static int callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
static void destroy_callback(void *userdata) {
int *n_called = userdata;
(*n_called) ++;
(*n_called)++;
}
TEST(destroy_callback) {

View File

@ -54,7 +54,7 @@ static void test_last_cap_probe(void) {
unsigned long p = (unsigned long)CAP_LAST_CAP;
if (prctl(PR_CAPBSET_READ, p) < 0) {
for (p--; p > 0; p --)
for (p--; p > 0; p--)
if (prctl(PR_CAPBSET_READ, p) >= 0)
break;
} else {

View File

@ -35,7 +35,7 @@ TEST(mempool_trim) {
assert_se(!a[x] || a[x]->value == x);
if (a[x])
n_freed ++;
n_freed++;
a[x] = mempool_free_tile(&test_mempool, a[x]);
}
@ -46,7 +46,7 @@ TEST(mempool_trim) {
for (size_t i = 2; i < NN; i += 3) {
assert_se(!a[i] || a[i]->value == i);
if (a[i])
n_freed ++;
n_freed++;
a[i] = mempool_free_tile(&test_mempool, a[i]);
}
@ -66,7 +66,7 @@ TEST(mempool_trim) {
for (size_t i = 0; i < NN; i += 1) {
assert_se(!a[i] || a[i]->value == i);
if (a[i])
n_freed ++;
n_freed++;
a[i] = mempool_free_tile(&test_mempool, a[i]);
}
@ -77,7 +77,7 @@ TEST(mempool_trim) {
for (size_t i = 0; i < NN; i += 1) {
assert_se(!b[i] || b[i]->value == ~(uint64_t) i);
if (b[i])
n_freed ++;
n_freed++;
b[i] = mempool_free_tile(&test_mempool, b[i]);
}