(void) table_set_display(details_table, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) 7);
}
- FOREACH_ARRAY(a, security_assessor_table, ELEMENTSOF(security_assessor_table)) {
+ FOREACH_ELEMENT(a, security_assessor_table) {
_cleanup_free_ char *d = NULL;
uint64_t badness;
void *data;
if (!t)
return;
- FOREACH_ARRAY(d, t->deps, ELEMENTSOF(t->deps))
+ FOREACH_ELEMENT(d, t->deps)
*d = strv_free(*d);
t->name = mfree(t->name);
assert(u);
if (u->type == UNIT_SERVICE)
- FOREACH_ARRAY(i, SERVICE(u)->exec_command, ELEMENTSOF(SERVICE(u)->exec_command))
+ FOREACH_ELEMENT(i, SERVICE(u)->exec_command)
LIST_FOREACH(command, j, *i)
RET_GATHER(r, verify_executable(u, j, root));
if (u->type == UNIT_SOCKET)
- FOREACH_ARRAY(i, SOCKET(u)->exec_command, ELEMENTSOF(SOCKET(u)->exec_command))
+ FOREACH_ELEMENT(i, SOCKET(u)->exec_command)
LIST_FOREACH(command, j, *i)
RET_GATHER(r, verify_executable(u, j, root));
if (!crt || !crt->cgroup_path)
return;
- FOREACH_ARRAY(i, crt->memory_accounting_last, ELEMENTSOF(crt->memory_accounting_last))
+ FOREACH_ELEMENT(i, crt->memory_accounting_last)
*i = UINT64_MAX;
}
.cgroup_invalidated_mask = _CGROUP_MASK_ALL,
};
- FOREACH_ARRAY(i, crt->memory_accounting_last, ELEMENTSOF(crt->memory_accounting_last))
+ FOREACH_ELEMENT(i, crt->memory_accounting_last)
*i = UINT64_MAX;
- FOREACH_ARRAY(i, crt->io_accounting_base, ELEMENTSOF(crt->io_accounting_base))
+ FOREACH_ELEMENT(i, crt->io_accounting_base)
*i = UINT64_MAX;
- FOREACH_ARRAY(i, crt->io_accounting_last, ELEMENTSOF(crt->io_accounting_last))
+ FOREACH_ELEMENT(i, crt->io_accounting_last)
*i = UINT64_MAX;
- FOREACH_ARRAY(i, crt->ip_accounting_extra, ELEMENTSOF(crt->ip_accounting_extra))
+ FOREACH_ELEMENT(i, crt->ip_accounting_extra)
*i = UINT64_MAX;
return TAKE_PTR(crt);
return log_exec_error_errno(c, p, r, "Failed to set sockaddr for '%s': %m", of->path);
sa_len = r;
- FOREACH_ARRAY(i, socket_types, ELEMENTSOF(socket_types)) {
+ FOREACH_ELEMENT(i, socket_types) {
_cleanup_close_ int fd = -EBADF;
fd = socket(AF_UNIX, *i|SOCK_CLOEXEC, 0);
return 0;
_cleanup_(sym_kmod_unrefp) struct kmod_ctx *ctx = NULL;
- FOREACH_ARRAY(kmod, kmod_table, ELEMENTSOF(kmod_table)) {
+ FOREACH_ELEMENT(kmod, kmod_table) {
if (kmod->path && access(kmod->path, F_OK) >= 0)
continue;
* the graph over 'before' edges in the actual job execution order. We traverse over both unit
* ordering dependencies and we test with job_compare() whether it is the 'before' edge in the job
* execution ordering. */
- FOREACH_ARRAY(d, directions, ELEMENTSOF(directions)) {
+ FOREACH_ELEMENT(d, directions) {
Unit *u;
UNIT_FOREACH_DEPENDENCY(u, j->unit, *d) {
};
int r;
- FOREACH_ARRAY(t, table, ELEMENTSOF(table)) {
+ FOREACH_ELEMENT(t, table) {
_cleanup_free_ char *b = NULL;
size_t sz = 0;
assert(ret);
- FOREACH_ARRAY(i, sleep_actions, ELEMENTSOF(sleep_actions))
+ FOREACH_ELEMENT(i, sleep_actions)
if (FLAGS_SET(mask, 1U << *i)) {
r = strv_extend(&actions, handle_action_to_string(*i));
if (r < 0)
HandleAction handle_action_sleep_select(Manager *m) {
assert(m);
- FOREACH_ARRAY(i, sleep_actions, ELEMENTSOF(sleep_actions)) {
+ FOREACH_ELEMENT(i, sleep_actions) {
HandleActionSleepMask action_mask = 1U << *i;
const HandleActionData *a;
_cleanup_free_ char *load_state = NULL;
{ "IOWeight", u->user_record->io_weight },
};
- FOREACH_ARRAY(st, settings, ELEMENTSOF(settings)) {
+ FOREACH_ELEMENT(st, settings) {
if (st->value == UINT64_MAX)
continue;
/* Generates expected records from the current SecureBoot state, as readable in the EFI variables
* right now. */
- FOREACH_ARRAY(vv, variables, ELEMENTSOF(variables)) {
+ FOREACH_ELEMENT(vv, variables) {
_cleanup_(json_variant_unrefp) JsonVariant *record = NULL;
_cleanup_free_ char *name = NULL;
}
if (!isempty(result))
- FOREACH_ARRAY(i, explanations, ELEMENTSOF(explanations))
+ FOREACH_ELEMENT(i, explanations)
if (streq(result, i->result)) {
log_error("Job for %s failed because %s.\n"
"See \"%s status %s\" and \"%s -xeu %s\" for details.\n",
* parse_compare_operator() are use on the same string? */
return _COMPARE_OPERATOR_INVALID;
- FOREACH_ARRAY(i, table, ELEMENTSOF(table)) {
+ FOREACH_ELEMENT(i, table) {
const char *e;
if (i->need_mask != 0 && !FLAGS_SET(flags, i->need_mask))
* to lock down these nodes as much as we can, but otherwise try to match them as closely as possible with the
* underlying file, i.e. in the best case we offer the same node type as the underlying node. */
- FOREACH_ARRAY(m, table, ELEMENTSOF(table)) {
+ FOREACH_ELEMENT(m, table) {
_cleanup_free_ char *path = NULL;
mode_t inode_type = *m;
const char *fn;
/* Checks if this mount point is considered "API", and hence
* should be ignored */
- FOREACH_ARRAY(i, mount_table, ELEMENTSOF(mount_table))
+ FOREACH_ELEMENT(i, mount_table)
if (path_equal(path, i->where))
return true;
if (!cg_is_legacy_force_enabled())
return -ERFKILL;
- FOREACH_ARRAY(mp, cgroupv1_mount_table, ELEMENTSOF(cgroupv1_mount_table)) {
+ FOREACH_ELEMENT(mp, cgroupv1_mount_table) {
r = mount_one(mp, loaded_policy);
if (r < 0)
return r;
return false;
}
- FOREACH_ARRAY(i, operations, ELEMENTSOF(operations)) {
+ FOREACH_ELEMENT(i, operations) {
r = sleep_supported_internal(sleep_config, *i, /* check_allowed = */ false, &support);
if (r < 0)
return r;
* and switch_root() nevertheless. */
(void) base_filesystem_create_fd(new_root_fd, new_root, UID_INVALID, GID_INVALID);
- FOREACH_ARRAY(transfer, transfer_table, ELEMENTSOF(transfer_table)) {
+ FOREACH_ELEMENT(transfer, transfer_table) {
_cleanup_free_ char *chased = NULL;
unsigned long mount_flags;
static int tpm2_ecc_curve_from_openssl_curve_id(int openssl_ecc_curve_id, TPM2_ECC_CURVE *ret) {
assert(ret);
- FOREACH_ARRAY(t, tpm2_openssl_ecc_curve_table, ELEMENTSOF(tpm2_openssl_ecc_curve_table))
+ FOREACH_ELEMENT(t, tpm2_openssl_ecc_curve_table)
if (t->openssl_ecc_curve_id == openssl_ecc_curve_id) {
*ret = t->tpm2_ecc_curve_id;
return 0;
static int tpm2_ecc_curve_to_openssl_curve_id(TPM2_ECC_CURVE tpm2_ecc_curve_id, int *ret) {
assert(ret);
- FOREACH_ARRAY(t, tpm2_openssl_ecc_curve_table, ELEMENTSOF(tpm2_openssl_ecc_curve_table))
+ FOREACH_ELEMENT(t, tpm2_openssl_ecc_curve_table)
if (t->tpm2_ecc_curve_id == tpm2_ecc_curve_id) {
*ret = t->openssl_ecc_curve_id;
return 0;
if (!error)
return 0;
- FOREACH_ARRAY(t, table, ELEMENTSOF(table))
+ FOREACH_ELEMENT(t, table)
if (streq(error, t->error))
return t->value;
};
/* Generates the right <match/> expressions for these credentials according to the shared mime-info spec */
- FOREACH_ARRAY(t, tags, ELEMENTSOF(tags)) {
+ FOREACH_ELEMENT(t, tags) {
_cleanup_free_ char *encoded = NULL;
assert_se(base64mem(t, sizeof(sd_id128_t), &encoded) >= 0);
{ "/", true },
};
- FOREACH_ARRAY(i, table, ELEMENTSOF(table)) {
+ FOREACH_ELEMENT(i, table) {
r = safe_fork("(switch-root)",
FORK_RESET_SIGNALS |
FORK_CLOSE_ALL_FDS |
int r;
- FOREACH_ARRAY(t, test_table, ELEMENTSOF(test_table)) {
+ FOREACH_ELEMENT(t, test_table) {
r = safe_fork("(umount-rec)",
FORK_RESET_SIGNALS |
TEST(digest_size) {
size_t size;
- FOREACH_ARRAY(t, digest_size_table, ELEMENTSOF(digest_size_table)) {
+ FOREACH_ELEMENT(t, digest_size_table) {
assert(openssl_digest_size(t->alg, &size) >= 0);
assert_se(size == t->size);
S_IFSOCK,
};
- FOREACH_ARRAY(m, types, ELEMENTSOF(types))
+ FOREACH_ELEMENT(m, types)
assert_se(inode_type_from_string(inode_type_to_string(*m)) == *m);
}
check_seal_unseal_for_handle(c, 0);
check_seal_unseal_for_handle(c, TPM2_SRK_HANDLE);
- FOREACH_ARRAY(template, test_templates, ELEMENTSOF(test_templates)) {
+ FOREACH_ELEMENT(template, test_templates) {
TPM2B_PUBLIC public = {
.publicArea = **template,
.size = sizeof(**template),
assert(c);
for (unsigned n_attempts = 0;;) {
- FOREACH_ARRAY(e, table, ELEMENTSOF(table)) {
+ FOREACH_ELEMENT(e, table) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_free_ char *state = NULL, *path = NULL;
assert(table);
- FOREACH_ARRAY(i, uid_range_table, ELEMENTSOF(uid_range_table)) {
+ FOREACH_ELEMENT(i, uid_range_table) {
_cleanup_free_ char *name = NULL, *comment = NULL;
if (!uid_range_covers(p, i->first, i->last - i->first + 1))
assert(table);
- FOREACH_ARRAY(i, uid_range_table, ELEMENTSOF(uid_range_table)) {
+ FOREACH_ELEMENT(i, uid_range_table) {
_cleanup_free_ char *name = NULL, *comment = NULL;
if (!uid_range_covers(p, i->first, i->last - i->first + 1))