diff options
-rw-r--r-- | src/basic/hashmap.c | 2 | ||||
-rw-r--r-- | src/boot/efi/util.h | 6 | ||||
-rw-r--r-- | src/shared/dns-domain.c | 18 | ||||
-rw-r--r-- | src/shared/userdb.c | 2 |
4 files changed, 10 insertions, 18 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index de7d16c397..cdf7db612c 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -774,7 +774,7 @@ static struct HashmapBase* hashmap_base_new(const struct hash_ops *hash_ops, enu HashmapBase *h; const struct hashmap_type_info *hi = &hashmap_type_info[type]; - bool use_pool = mempool_enabled && mempool_enabled(); + bool use_pool = mempool_enabled && mempool_enabled(); /* mempool_enabled is a weak symbol */ h = use_pool ? mempool_alloc0_tile(hi->mempool) : malloc0(hi->head_size); if (!h) diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h index 699f1a2c7c..cc750d7cca 100644 --- a/src/boot/efi/util.h +++ b/src/boot/efi/util.h @@ -84,12 +84,12 @@ static inline void *xmalloc_multiply(size_t size, size_t n) { /* Use malloc attribute as this never returns p like userspace realloc. */ _malloc_ _alloc_(3) _returns_nonnull_ _warn_unused_result_ static inline void *xrealloc(void *p, size_t old_size, size_t new_size) { - void *r = xmalloc(new_size); + void *t = xmalloc(new_size); new_size = MIN(old_size, new_size); if (new_size > 0) - memcpy(r, p, new_size); + memcpy(t, p, new_size); free(p); - return r; + return t; } #define xpool_print(fmt, ...) ((char16_t *) ASSERT_SE_PTR(PoolPrint((fmt), ##__VA_ARGS__))) diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c index a071976442..d209e17f95 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c @@ -297,7 +297,6 @@ int dns_label_escape_new(const char *p, size_t l, char **ret) { int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max) { _cleanup_free_ uint32_t *input = NULL; size_t input_size, l; - const char *p; bool contains_8bit = false; char buffer[DNS_LABEL_MAX+1]; int r; @@ -314,7 +313,7 @@ int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded if (encoded_size <= 0) return -EINVAL; - for (p = encoded; p < encoded + encoded_size; p++) + for (const char *p = encoded; p < encoded + encoded_size; p++) if ((uint8_t) *p > 127) contains_8bit = true; @@ -756,9 +755,8 @@ int dns_name_address(const char *p, int *ret_family, union in_addr_union *ret_ad return r; if (r > 0) { uint8_t a[4]; - unsigned i; - for (i = 0; i < ELEMENTSOF(a); i++) { + for (size_t i = 0; i < ELEMENTSOF(a); i++) { char label[DNS_LABEL_MAX+1]; r = dns_label_unescape(&p, label, sizeof label, 0); @@ -792,9 +790,8 @@ int dns_name_address(const char *p, int *ret_family, union in_addr_union *ret_ad return r; if (r > 0) { struct in6_addr a; - unsigned i; - for (i = 0; i < ELEMENTSOF(a.s6_addr); i++) { + for (size_t i = 0; i < ELEMENTSOF(a.s6_addr); i++) { char label[DNS_LABEL_MAX+1]; int x, y; @@ -906,8 +903,6 @@ int dns_name_to_wire_format(const char *domain, uint8_t *buffer, size_t len, boo } static bool srv_type_label_is_valid(const char *label, size_t n) { - size_t k; - assert(label); if (n < 2) /* Label needs to be at least 2 chars long */ @@ -921,12 +916,11 @@ static bool srv_type_label_is_valid(const char *label, size_t n) { return false; /* Third and further chars must be alphanumeric or a hyphen */ - for (k = 2; k < n; k++) { + for (size_t k = 2; k < n; k++) if (!ascii_isalpha(label[k]) && !ascii_isdigit(label[k]) && label[k] != '-') return false; - } return true; } @@ -1122,14 +1116,12 @@ finish: } static int dns_name_build_suffix_table(const char *name, const char *table[]) { - const char *p; + const char *p = ASSERT_PTR(name); unsigned n = 0; int r; - assert(name); assert(table); - p = name; for (;;) { if (n > DNS_N_LABELS_MAX) return -EINVAL; diff --git a/src/shared/userdb.c b/src/shared/userdb.c index de7eef687e..aa55cc00ae 100644 --- a/src/shared/userdb.c +++ b/src/shared/userdb.c @@ -469,7 +469,7 @@ static int userdb_start_query( streq(de->d_name, "io.systemd.DynamicUser")) continue; - /* Avoid NSS is this is requested. Note that we also skip NSS when we were asked to skip the + /* Avoid NSS if this is requested. Note that we also skip NSS when we were asked to skip the * multiplexer, since in that case it's safer to do NSS in the client side emulation below * (and when we run as part of systemd-userdbd.service we don't want to talk to ourselves * anyway). */ |