diff --git a/src/basic/user-util.c b/src/basic/user-util.c index 80f9ff144b1..e2857b31027 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -990,13 +990,11 @@ int putsgent_sane(const struct sgrp *sg, FILE *stream) { #endif int fgetpwent_sane(FILE *stream, struct passwd **pw) { - struct passwd *p; - - assert(pw); assert(stream); + assert(pw); errno = 0; - p = fgetpwent(stream); + struct passwd *p = fgetpwent(stream); if (!p && errno != ENOENT) return errno_or_else(EIO); @@ -1005,13 +1003,11 @@ int fgetpwent_sane(FILE *stream, struct passwd **pw) { } int fgetspent_sane(FILE *stream, struct spwd **sp) { - struct spwd *s; - - assert(sp); assert(stream); + assert(sp); errno = 0; - s = fgetspent(stream); + struct spwd *s = fgetspent(stream); if (!s && errno != ENOENT) return errno_or_else(EIO); @@ -1020,13 +1016,11 @@ int fgetspent_sane(FILE *stream, struct spwd **sp) { } int fgetgrent_sane(FILE *stream, struct group **gr) { - struct group *g; - - assert(gr); assert(stream); + assert(gr); errno = 0; - g = fgetgrent(stream); + struct group *g = fgetgrent(stream); if (!g && errno != ENOENT) return errno_or_else(EIO); @@ -1036,13 +1030,11 @@ int fgetgrent_sane(FILE *stream, struct group **gr) { #if ENABLE_GSHADOW int fgetsgent_sane(FILE *stream, struct sgrp **sg) { - struct sgrp *s; - - assert(sg); assert(stream); + assert(sg); errno = 0; - s = fgetsgent(stream); + struct sgrp *s = fgetsgent(stream); if (!s && errno != ENOENT) return errno_or_else(EIO); diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index 0b8393ca2cf..62873e01112 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -285,15 +285,13 @@ int dhcp6_option_append_vendor_option(uint8_t **buf, size_t *offset, OrderedSet } static int option_append_ia_address(uint8_t **buf, size_t *offset, const struct iaaddr *address) { - struct iaaddr a; - assert(buf); assert(*buf); assert(offset); assert(address); /* Do not append T1 and T2. */ - a = (struct iaaddr) { + const struct iaaddr a = { .address = address->address, }; @@ -301,8 +299,6 @@ static int option_append_ia_address(uint8_t **buf, size_t *offset, const struct } static int option_append_pd_prefix(uint8_t **buf, size_t *offset, const struct iapdprefix *prefix) { - struct iapdprefix p; - assert(buf); assert(*buf); assert(offset); @@ -312,7 +308,7 @@ static int option_append_pd_prefix(uint8_t **buf, size_t *offset, const struct i return -EINVAL; /* Do not append T1 and T2. */ - p = (struct iapdprefix) { + const struct iapdprefix p = { .prefixlen = prefix->prefixlen, .address = prefix->address, };