BEGIN{
print "const char *arphrd_to_name(int id) {"
- print " switch(id) {"
+ print " switch (id) {"
}
!/^HDLC$/ {
printf " case ARPHRD_%s: return \"%s\";\n", $1, $1
unsigned n_buckets; /* number of buckets */
unsigned idx_lowest_entry; /* Index below which all buckets are free.
- Makes "while(hashmap_steal_first())" loops
+ Makes "while (hashmap_steal_first())" loops
O(n) instead of O(n^2) for unordered hashmaps. */
uint8_t _pad[3]; /* padding for the whole HashmapBase */
/* The bitfields in HashmapBase complete the alignment of the whole thing. */
({ \
const union sockaddr_union *__sa = &(sa); \
size_t _len; \
- switch(__sa->sa.sa_family) { \
+ switch (__sa->sa.sa_family) { \
case AF_INET: \
_len = sizeof(struct sockaddr_in); \
break; \
fputc_unlocked('\n', stdout); \
} \
funlockfile(stdout); \
- } while(false)
+ } while (false)
by_procfs = true; /* fgetxattr() is not going to work, go via /proc/ link right-away */
}
- for(;;) {
+ for (;;) {
_cleanup_free_ char *v = NULL;
ssize_t n;
h = &gpt_header_buffer->gpt_header;
/* Some superficial validation of the GPT header */
- if(CompareMem(&h->Header.Signature, "EFI PART", sizeof(h->Header.Signature) != 0))
+ if (CompareMem(&h->Header.Signature, "EFI PART", sizeof(h->Header.Signature) != 0))
return FALSE;
if (h->Header.HeaderSize < 92 || h->Header.HeaderSize > 512)
assert(acc);
for (; *acc; acc++)
- switch(*acc) {
+ switch (*acc) {
case 'r':
r |= BPF_DEVCG_ACC_READ;
break;
for (size_t i = 0; i < n_changes; i++)
- switch(changes[i].type_or_errno) {
+ switch (changes[i].type_or_errno) {
case 0 ... _UNIT_FILE_CHANGE_TYPE_MAX: /* not errors */
continue;
}
static int callback_type_to_priority(int type) {
- switch(type) {
+ switch (type) {
case SELINUX_ERROR:
return LOG_ERR;
assert(loaded_policy);
r = write_access2_rules("/etc/smack/accesses.d/");
- switch(r) {
+ switch (r) {
case -ENOENT:
log_debug("Smack is not enabled in the kernel.");
return 0;
#endif
r = write_cipso2_rules("/etc/smack/cipso.d/");
- switch(r) {
+ switch (r) {
case -ENOENT:
log_debug("Smack/CIPSO is not enabled in the kernel.");
return 0;
}
r = write_netlabel_rules("/etc/smack/netlabel.d/");
- switch(r) {
+ switch (r) {
case -ENOENT:
log_debug("Smack/CIPSO is not enabled in the kernel.");
return 0;
}
r = write_onlycap_list();
- switch(r) {
+ switch (r) {
case -ENOENT:
log_debug("Smack is not enabled in the kernel.");
break;
if (r != 0)
return r;
- switch(x->peer.sa.sa_family) {
+ switch (x->peer.sa.sa_family) {
case AF_INET:
return memcmp(&x->peer.in.sin_addr, &y->peer.in.sin_addr, sizeof(x->peer.in.sin_addr));
case AF_INET6:
assert(argv);
while ((c = getopt_long(argc, argv, "hA:o:F:1D:rS:U:qn:", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return verb_help(0, NULL, NULL);
CASE_F_10,CASE_F_9,CASE_F_8,CASE_F_7,CASE_F_6,CASE_F_5,CASE_F_4,CASE_F_3,CASE_F_2,CASE_F_1) \
(CASE_F,__VA_ARGS__)
-#define IN_SET(x, ...) \
- ({ \
- sd_bool _found = sd_false; \
+#define IN_SET(x, ...) \
+ ({ \
+ sd_bool _found = sd_false; \
/* If the build breaks in the line below, you need to extend the case macros. (We use "long double" as \
* type for the array, in the hope that checkers such as ubsan don't complain that the initializers for \
* the array are not representable by the base type. Ideally we'd use typeof(x) as base type, but that \
* doesn't work, as we want to use this on bitfields and gcc refuses typeof() on bitfields.) */ \
static const long double __assert_in_set[] _unused_ = { __VA_ARGS__ }; \
- assert_cc(ELEMENTSOF(__assert_in_set) <= 20); \
- switch(x) { \
- FOR_EACH_MAKE_CASE(__VA_ARGS__) \
- _found = sd_true; \
- break; \
- default: \
- break; \
- } \
- _found; \
+ assert_cc(ELEMENTSOF(__assert_in_set) <= 20); \
+ switch (x) { \
+ FOR_EACH_MAKE_CASE(__VA_ARGS__) \
+ _found = sd_true; \
+ break; \
+ default: \
+ break; \
+ } \
+ _found; \
})
/* Takes inspiration from Rust's Option::take() method: reads and returns a pointer, but at the same time
* http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
*/
- switch(t) {
+ switch (t) {
case 1: /* Desktop */
case 3: /* Workstation */
assert(argv);
while ((c = getopt_long(argc, argv, "ust:r:h", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return help();
while ((c = getopt_long(argc, argv, "hD:", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return help();
assert(argv);
while ((c = getopt_long(argc, argv, "ho:", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return help();
const void *key;
int r;
- switch(s->split_mode) {
+ switch (s->split_mode) {
case JOURNAL_WRITE_SPLIT_NONE:
key = "one and only";
break;
return log_error_errno(errno, "accept() on fd:%d failed: %m", fd);
}
- switch(socket_address_family(addr)) {
+ switch (socket_address_family(addr)) {
case AF_INET:
case AF_INET6: {
_cleanup_free_ char *a = NULL;
for (;;) {
- switch(u->entry_state) {
+ switch (u->entry_state) {
case ENTRY_CURSOR: {
u->current_cursor = mfree(u->current_cursor);
opterr = 0;
while ((c = getopt_long(argc, argv, "hu:mM:D:", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return help();
}
static bool shall_try_append_again(JournalFile *f, int r) {
- switch(r) {
+ switch (r) {
case -E2BIG: /* Hit configured limit */
case -EFBIG: /* Hit fs limit */
assert(buf || buflen == 0);
- for(size_t offset = 0; offset < buflen;) {
+ for (size_t offset = 0; offset < buflen;) {
const uint8_t *data;
size_t data_len;
uint16_t code;
if (r < 0)
return r;
- switch(code) {
+ switch (code) {
case SD_DHCP6_OPTION_STATUS_CODE: {
_cleanup_free_ char *msg = NULL;
assert_return(client, -EINVAL);
assert_return(IN_SET(client->state, DHCP_STATE_INIT, DHCP_STATE_STOPPED), -EBUSY);
- switch(option) {
+ switch (option) {
case SD_DHCP_OPTION_PAD:
case SD_DHCP_OPTION_OVERLOAD:
assert(lease);
- switch(code) {
+ switch (code) {
case SD_DHCP_OPTION_IP_ADDRESS_LEASE_TIME:
r = lease_parse_u32(option, len, &lease->lifetime, 1);
assert(req);
- switch(code) {
+ switch (code) {
case SD_DHCP_OPTION_IP_ADDRESS_LEASE_TIME:
if (len == 4)
req->lifetime = unaligned_read_be32(option);
existing_lease = hashmap_get(server->bound_leases_by_client_id, &req->client_id);
static_lease = hashmap_get(server->static_leases_by_client_id, &req->client_id);
- switch(type) {
+ switch (type) {
case DHCP_DISCOVER: {
be32_t address = INADDR_ANY;
if (r < 0)
return r;
- switch(subopt) {
+ switch (subopt) {
case DHCP6_NTP_SUBOPTION_SRV_ADDR:
case DHCP6_NTP_SUBOPTION_MC_ADDR:
if (sublen != 16)
}
static int check_options(uint8_t code, uint8_t len, const void *option, void *userdata) {
- switch(code) {
+ switch (code) {
case SD_DHCP_OPTION_CLIENT_IDENTIFIER:
{
uint32_t iaid;
};
static const char *dhcp_type(int type) {
- switch(type) {
+ switch (type) {
case DHCP_DISCOVER:
return "DHCPDISCOVER";
case DHCP_OFFER:
assert_se(*descpos >= 0);
while (*descpos < *desclen) {
- switch(descoption[*descpos]) {
+ switch (descoption[*descpos]) {
case SD_DHCP_OPTION_PAD:
*descpos += 1;
break;
static void basic_request_handler(sd_ipv4ll *ll, int event, void *userdata) {
assert_se(userdata == basic_request_handler_userdata);
- switch(event) {
+ switch (event) {
case SD_IPV4LL_EVENT_STOP:
basic_request_handler_stop = 1;
break;
# SPDX-License-Identifier: LGPL-2.1-or-later
BEGIN{
- print "const char *audit_type_to_string(int type) {\n\tswitch(type) {"
+ print "const char *audit_type_to_string(int type) {"
+ print " switch (type) {"
}
{
printf " case AUDIT_%s: return \"%s\";\n", $1, $1
}
END{
- print " default: return NULL;\n\t}\n}\n"
+ print " default: return NULL;"
+ print " }"
+ print "}"
}
int r;
assert_return(rtnl_message_type_is_nexthop(nlmsg_type), -EINVAL);
- switch(nlmsg_type) {
+ switch (nlmsg_type) {
case RTM_DELNEXTHOP:
assert_return(nh_family == AF_UNSPEC, -EINVAL);
_fallthrough_;
if (IN_SET(type, NLMSG_DONE, NLMSG_ERROR))
nl_type = type_system_get_type(&basic_type_system, type);
else
- switch(nl->protocol) {
+ switch (nl->protocol) {
case NETLINK_ROUTE:
nl_type = rtnl_get_type(type);
break;
assert(list);
- switch(type) {
+ switch (type) {
case SD_PATH_SEARCH_BINARIES:
return search_from_environment(list,
assert(argv);
while ((c = getopt_long(argc, argv, "hn", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return help();
# SPDX-License-Identifier: LGPL-2.1-or-later
BEGIN{
- print "const char *dns_type_to_string(int type) {\n\tswitch(type) {"
+ print "const char *dns_type_to_string(int type) {"
+ print " switch (type) {"
}
{
printf " case DNS_TYPE_%s: return ", $1;
printf "\"%s\";\n", $1
}
END{
- print " default: return NULL;\n\t}\n}\n"
+ print " default: return NULL;"
+ print " }"
+ print "}"
}
arg_mode = _MODE_INVALID;
while ((c = getopt_long(argc, argv, "hadxpfm:uIi:l:Rr:vV", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return resolvconf_help();
assert(argv);
while ((c = getopt_long(argc, argv, "h46i:t:c:p:", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return compat_help();
assert(argv);
while ((c = getopt_long(argc, argv, "h46i:t:c:p:", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return native_help();
h = DNS_PACKET_HEADER(p);
- switch(p->protocol) {
+ switch (p->protocol) {
case DNS_PROTOCOL_LLMNR:
assert(!truncated);
assert(rr);
if (rr->key) {
- switch(rr->key->type) {
+ switch (rr->key->type) {
case DNS_TYPE_SRV:
free(rr->srv.name);
assert(rr);
assert(out);
- switch(rr->unparsable ? _DNS_TYPE_INVALID : rr->key->type) {
+ switch (rr->unparsable ? _DNS_TYPE_INVALID : rr->key->type) {
case DNS_TYPE_SRV:
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
ss = gnutls_record_uncork(stream->dnstls_data.session, 0);
if (ss < 0)
- switch(ss) {
+ switch (ss) {
case GNUTLS_E_INTERRUPTED:
return -EINTR;
case GNUTLS_E_AGAIN:
ss = gnutls_record_recv(stream->dnstls_data.session, buf, count);
if (ss < 0)
- switch(ss) {
+ switch (ss) {
case GNUTLS_E_INTERRUPTED:
return -EINTR;
case GNUTLS_E_AGAIN:
Disabled reason = ltype;
- switch(reason) {
+ switch (reason) {
case DISABLED_CONFIGURATION:
log_syntax(unit, LOG_DEBUG, filename, line, 0,
if (dest != _v) \
updated = true; \
dest = _v; \
- } while(false)
+ } while (false)
#define UPDATE_WITH_MAX(dest, max, val, updated) \
do { \
if (dest != _v) \
updated = true; \
dest = _v; \
- } while(false)
+ } while (false)
int ethtool_set_wol(
int *ethtool_fd,
struct in_addr_prefix *p;
SET_FOREACH(p, prefixes)
- switch(p->family) {
+ switch (p->family) {
case AF_INET:
assert(p->prefixlen <= 32);
if (p->prefixlen == 0)
if (p->prefixlen == 0)
continue;
- switch(p->family) {
+ switch (p->family) {
case AF_INET:
prefixlens = ipv4_prefixlens;
n = &ipv4_n_prefixlens;
for (size_t i = 0; i < n_changes; i++) {
assert(verb || changes[i].type_or_errno >= 0);
- switch(changes[i].type_or_errno) {
+ switch (changes[i].type_or_errno) {
case UNIT_FILE_SYMLINK:
if (!quiet)
log_info("Created symlink %s %s %s.",
int journal_importer_process_data(JournalImporter *imp) {
int r;
- switch(imp->state) {
+ switch (imp->state) {
case IMPORTER_STATE_LINE: {
char *line, *sep;
size_t n = 0;
if (!runtime_dir)
runtime_dir = "/run";
- switch(mode & S_IFMT) {
+ switch (mode & S_IFMT) {
case S_IFREG:
node = "/systemd/inaccessible/reg";
break;
* Names used here should be the same as those used for ConditionArchitecture=,
* except for "subarchitectures" like x32. */
- switch(c) {
+ switch (c) {
case SCMP_ARCH_NATIVE:
return "native";
case SCMP_ARCH_X86:
assert(argv);
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return help(argv[0], service, description, bus_objects);
(void) sd_device_get_syspath(_d, &_p); \
(void) sd_device_get_subsystem(_d, &_s); \
STAP_PROBEV(udev, name, device_action_to_string(_a), _n, _p, _s __VA_OPT__(,) __VA_ARGS__);\
- } while(false);
+ } while (false);
#else
#define DEVICE_TRACE_POINT(name, dev, ...) ((void) 0)
#endif
assert(argv);
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'h':
return help();
assert_se(MALLOC_SIZEOF_SAFE(f) >= sizeof(*f) * n); \
assert_se(malloc_usable_size(f) >= sizeof(*f) * n); \
assert_se(__builtin_object_size(f, 0) >= sizeof(*f) * n); \
- } while(false)
+ } while (false)
TEST(malloc_size_safe) {
_cleanup_free_ uint32_t *f = NULL;
assert_se(argv);
while ((c = getopt_long(argc, argv, "r:", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'r':
arg_root = optarg;
break;
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
"Invalid format capacities length.");
- switch(format[8] & 3) {
+ switch (format[8] & 3) {
case 1:
/* This means that last format was interrupted or failed, blank dvd-ram discs are
* factory formatted. Take no action here as it takes quite a while to reformat a
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
"Unexpected sector size: %i", sector_size);
- switch(size_in_megs) {
+ switch (size_in_megs) {
case 1:
case 2:
spare_count = 6;
int c;
while ((c = getopt_long(argc, argv, "ust:r:Vh", options, NULL)) >= 0)
- switch(c) {
+ switch (c) {
case 'u':
arg_update = true;
break;
assert(device);
- switch(query) {
+ switch (query) {
case QUERY_NAME: {
const char *node;