]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: use isempty() consistently 630/head
authorNamhyung Kim <namhyung@gmail.com>
Fri, 3 Jul 2015 03:40:11 +0000 (12:40 +0900)
committerNamhyung Kim <namhyung@gmail.com>
Mon, 20 Jul 2015 14:41:18 +0000 (23:41 +0900)
Instead of open-coding, use isempty() to check NULL or empty string
for consistency.

src/libsystemd/sd-bus/bus-control.c

index 99115d5e492f4157ee3722bc51a4e60131d63b8a..c53666ddd02f396ba41b4672d25cf770446e6c37 100644 (file)
@@ -1131,7 +1131,7 @@ static int add_name_change_match(sd_bus *bus,
 
                 /* If the old name is unset or empty, then
                  * this can match against added names */
-                if (!old_owner || old_owner[0] == 0) {
+                if (isempty(old_owner)) {
                         item->type = KDBUS_ITEM_NAME_ADD;
 
                         r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_ADD, m);
@@ -1141,7 +1141,7 @@ static int add_name_change_match(sd_bus *bus,
 
                 /* If the new name is unset or empty, then
                  * this can match against removed names */
-                if (!new_owner || new_owner[0] == 0) {
+                if (isempty(new_owner)) {
                         item->type = KDBUS_ITEM_NAME_REMOVE;
 
                         r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_ADD, m);
@@ -1185,7 +1185,7 @@ static int add_name_change_match(sd_bus *bus,
 
                 /* If the old name is unset or empty, then this can
                  * match against added ids */
-                if (!old_owner || old_owner[0] == 0) {
+                if (isempty(old_owner)) {
                         item->type = KDBUS_ITEM_ID_ADD;
                         if (!isempty(new_owner))
                                 item->id_change.id = new_owner_id;
@@ -1197,7 +1197,7 @@ static int add_name_change_match(sd_bus *bus,
 
                 /* If thew new name is unset or empty, then this can
                  * match against removed ids */
-                if (!new_owner || new_owner[0] == 0) {
+                if (isempty(new_owner)) {
                         item->type = KDBUS_ITEM_ID_REMOVE;
                         if (!isempty(old_owner))
                                 item->id_change.id = old_owner_id;