tree-wide: do not wrap assert_se in extra parentheses

We were inconsitently using them in some cases, but in majority not.
Using assignment in assert_se is very common, not an exception like in
'if', so let's drop the extra parens everywhere.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-05-14 09:12:12 +02:00
parent 6978efcffb
commit dcd6361ea1
8 changed files with 16 additions and 15 deletions

View file

@ -918,7 +918,7 @@ int systemd_installation_has_version(const char *root, unsigned minimal_version)
if (r < 0)
return r;
assert_se((c = endswith(path, "*.so")));
assert_se(c = endswith(path, "*.so"));
*c = '\0'; /* truncate the glob part */
STRV_FOREACH(name, names) {

View file

@ -68,7 +68,8 @@ static void *server(void *p) {
if (sd_bus_message_is_method_call(m, "org.freedesktop.systemd.test", "Exit")) {
assert_se((sd_bus_can_send(bus, 'h') >= 1) == (c->server_negotiate_unix_fds && c->client_negotiate_unix_fds));
assert_se((sd_bus_can_send(bus, 'h') >= 1) ==
(c->server_negotiate_unix_fds && c->client_negotiate_unix_fds));
r = sd_bus_message_new_method_return(m, &reply);
if (r < 0) {

View file

@ -95,7 +95,7 @@ static void test_copy_tree(void) {
STRV_FOREACH(p, files) {
_cleanup_free_ char *f;
assert_se((f = strappend(original_dir, *p)));
assert_se(f = strappend(original_dir, *p));
assert_se(mkdir_parents(f, 0755) >= 0);
assert_se(write_string_file(f, "file", WRITE_STRING_FILE_CREATE) == 0);
@ -104,8 +104,8 @@ static void test_copy_tree(void) {
STRV_FOREACH_PAIR(link, p, links) {
_cleanup_free_ char *f, *l;
assert_se((f = strappend(original_dir, *p)));
assert_se((l = strappend(original_dir, *link)));
assert_se(f = strappend(original_dir, *p));
assert_se(l = strappend(original_dir, *link));
assert_se(mkdir_parents(l, 0755) >= 0);
assert_se(symlink(f, l) == 0);
@ -120,7 +120,7 @@ static void test_copy_tree(void) {
_cleanup_free_ char *buf = NULL, *f;
size_t sz = 0;
assert_se((f = strappend(copy_dir, *p)));
assert_se(f = strappend(copy_dir, *p));
assert_se(access(f, F_OK) == 0);
assert_se(read_full_file(f, &buf, &sz) == 0);
@ -130,8 +130,8 @@ static void test_copy_tree(void) {
STRV_FOREACH_PAIR(link, p, links) {
_cleanup_free_ char *target = NULL, *f, *l;
assert_se((f = strjoin(original_dir, *p)));
assert_se((l = strjoin(copy_dir, *link)));
assert_se(f = strjoin(original_dir, *p));
assert_se(l = strjoin(copy_dir, *link));
assert_se(chase_symlinks(l, NULL, 0, &target) == 1);
assert_se(path_equal(f, target));

View file

@ -13,7 +13,7 @@
int main(int argc, char **argv) {
void *handle;
assert_se((handle = dlopen(argv[1], RTLD_NOW)));
assert_se(handle = dlopen(argv[1], RTLD_NOW));
assert_se(dlclose(handle) == 0);
return EXIT_SUCCESS;

View file

@ -467,7 +467,7 @@ static void test_write_string_file_verify(void) {
int r;
assert_se(read_one_line_file("/proc/cmdline", &buf) >= 0);
assert_se((buf2 = strjoin(buf, "\n")));
assert_se(buf2 = strjoin(buf, "\n"));
r = write_string_file("/proc/cmdline", buf, 0);
assert_se(IN_SET(r, -EACCES, -EIO));

View file

@ -85,10 +85,10 @@ static void test_unhexmem_one(const char *s, size_t l, int retval) {
if (retval == 0) {
char *answer;
if (l == (size_t) - 1)
if (l == (size_t) -1)
l = strlen(s);
assert_se((hex = hexmem(mem, len)));
assert_se(hex = hexmem(mem, len));
answer = strndupa(s, l);
assert_se(streq(delete_chars(answer, WHITESPACE), hex));
}

View file

@ -87,7 +87,7 @@ static int print_gaih_addrtuples(const struct gaih_addrtuple *tuples) {
r = in_addr_to_string(it->family, &u, &a);
assert_se(IN_SET(r, 0, -EAFNOSUPPORT));
if (r == -EAFNOSUPPORT)
assert_se((a = hexmem(it->addr, 16)));
assert_se(a = hexmem(it->addr, 16));
if (it->scopeid == 0)
goto numerical_index;

View file

@ -636,8 +636,8 @@ static void test_install_printf(void) {
assert_se(specifier_machine_id('m', NULL, NULL, &mid) >= 0 && mid);
assert_se(specifier_boot_id('b', NULL, NULL, &bid) >= 0 && bid);
assert_se((host = gethostname_malloc()));
assert_se((user = uid_to_name(getuid())));
assert_se(host = gethostname_malloc());
assert_se(user = uid_to_name(getuid()));
assert_se(asprintf(&uid, UID_FMT, getuid()) >= 0);
#define expect(src, pattern, result) \