mirror of
https://github.com/systemd/systemd.git
synced 2025-01-06 17:18:12 +03:00
Merge pull request #24973 from keszybz/simplify-variable-declarations
Simplify variable declarations
This commit is contained in:
commit
6c65a9e1d6
@ -990,13 +990,11 @@ int putsgent_sane(const struct sgrp *sg, FILE *stream) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fgetpwent_sane(FILE *stream, struct passwd **pw) {
|
int fgetpwent_sane(FILE *stream, struct passwd **pw) {
|
||||||
struct passwd *p;
|
|
||||||
|
|
||||||
assert(pw);
|
|
||||||
assert(stream);
|
assert(stream);
|
||||||
|
assert(pw);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
p = fgetpwent(stream);
|
struct passwd *p = fgetpwent(stream);
|
||||||
if (!p && errno != ENOENT)
|
if (!p && errno != ENOENT)
|
||||||
return errno_or_else(EIO);
|
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) {
|
int fgetspent_sane(FILE *stream, struct spwd **sp) {
|
||||||
struct spwd *s;
|
|
||||||
|
|
||||||
assert(sp);
|
|
||||||
assert(stream);
|
assert(stream);
|
||||||
|
assert(sp);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
s = fgetspent(stream);
|
struct spwd *s = fgetspent(stream);
|
||||||
if (!s && errno != ENOENT)
|
if (!s && errno != ENOENT)
|
||||||
return errno_or_else(EIO);
|
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) {
|
int fgetgrent_sane(FILE *stream, struct group **gr) {
|
||||||
struct group *g;
|
|
||||||
|
|
||||||
assert(gr);
|
|
||||||
assert(stream);
|
assert(stream);
|
||||||
|
assert(gr);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
g = fgetgrent(stream);
|
struct group *g = fgetgrent(stream);
|
||||||
if (!g && errno != ENOENT)
|
if (!g && errno != ENOENT)
|
||||||
return errno_or_else(EIO);
|
return errno_or_else(EIO);
|
||||||
|
|
||||||
@ -1036,13 +1030,11 @@ int fgetgrent_sane(FILE *stream, struct group **gr) {
|
|||||||
|
|
||||||
#if ENABLE_GSHADOW
|
#if ENABLE_GSHADOW
|
||||||
int fgetsgent_sane(FILE *stream, struct sgrp **sg) {
|
int fgetsgent_sane(FILE *stream, struct sgrp **sg) {
|
||||||
struct sgrp *s;
|
|
||||||
|
|
||||||
assert(sg);
|
|
||||||
assert(stream);
|
assert(stream);
|
||||||
|
assert(sg);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
s = fgetsgent(stream);
|
struct sgrp *s = fgetsgent(stream);
|
||||||
if (!s && errno != ENOENT)
|
if (!s && errno != ENOENT)
|
||||||
return errno_or_else(EIO);
|
return errno_or_else(EIO);
|
||||||
|
|
||||||
|
@ -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) {
|
static int option_append_ia_address(uint8_t **buf, size_t *offset, const struct iaaddr *address) {
|
||||||
struct iaaddr a;
|
|
||||||
|
|
||||||
assert(buf);
|
assert(buf);
|
||||||
assert(*buf);
|
assert(*buf);
|
||||||
assert(offset);
|
assert(offset);
|
||||||
assert(address);
|
assert(address);
|
||||||
|
|
||||||
/* Do not append T1 and T2. */
|
/* Do not append T1 and T2. */
|
||||||
a = (struct iaaddr) {
|
const struct iaaddr a = {
|
||||||
.address = address->address,
|
.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) {
|
static int option_append_pd_prefix(uint8_t **buf, size_t *offset, const struct iapdprefix *prefix) {
|
||||||
struct iapdprefix p;
|
|
||||||
|
|
||||||
assert(buf);
|
assert(buf);
|
||||||
assert(*buf);
|
assert(*buf);
|
||||||
assert(offset);
|
assert(offset);
|
||||||
@ -312,7 +308,7 @@ static int option_append_pd_prefix(uint8_t **buf, size_t *offset, const struct i
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Do not append T1 and T2. */
|
/* Do not append T1 and T2. */
|
||||||
p = (struct iapdprefix) {
|
const struct iapdprefix p = {
|
||||||
.prefixlen = prefix->prefixlen,
|
.prefixlen = prefix->prefixlen,
|
||||||
.address = prefix->address,
|
.address = prefix->address,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user