summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-05-14 09:12:12 +0200
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commitec8402b80170cdfdaab0698a9eff00a6a9c357ed (patch)
tree994fd00f51d3540a958c6f48aa7eb25d7ee81088 /src
parent8bb71d26a90460ed8e138140c16a71e0f560e0cd (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/basic/path-util.c5
-rw-r--r--src/libelogind/sd-bus/test-bus-server.c3
-rw-r--r--src/test/test-copy.c12
-rw-r--r--src/test/test-dlopen.c2
-rw-r--r--src/test/test-hexdecoct.c4
5 files changed, 13 insertions, 13 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index 5d39cf0d6..957c13bb3 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -692,12 +692,11 @@ int parse_path_argument_and_warn(const char *path, bool suppress_root, char **ar
return log_error_errno(r, "Failed to parse path \"%s\" and make it absolute: %m", path);
path_kill_slashes(p);
- if (suppress_root && empty_or_root(p))
+ if (suppress_root && path_equal(p, "/"))
p = mfree(p);
free(*arg);
*arg = p;
-
return 0;
}
#endif // 0
@@ -928,7 +927,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) {
diff --git a/src/libelogind/sd-bus/test-bus-server.c b/src/libelogind/sd-bus/test-bus-server.c
index f862dc06e..373d59643 100644
--- a/src/libelogind/sd-bus/test-bus-server.c
+++ b/src/libelogind/sd-bus/test-bus-server.c
@@ -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) {
diff --git a/src/test/test-copy.c b/src/test/test-copy.c
index 7337a8ae6..21cfceac2 100644
--- a/src/test/test-copy.c
+++ b/src/test/test-copy.c
@@ -96,7 +96,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);
@@ -105,8 +105,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);
@@ -121,7 +121,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);
@@ -131,8 +131,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));
diff --git a/src/test/test-dlopen.c b/src/test/test-dlopen.c
index 151d2d72b..febfc60e0 100644
--- a/src/test/test-dlopen.c
+++ b/src/test/test-dlopen.c
@@ -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;
diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
index 6546be5c6..13b1fb7e3 100644
--- a/src/test/test-hexdecoct.c
+++ b/src/test/test-hexdecoct.c
@@ -88,10 +88,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));
}