tree-wide: use streq() instead of streq_ptr()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 1 Sep 2018 14:03:22 +0000 (23:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 23 Sep 2018 08:18:50 +0000 (17:18 +0900)
src/backlight/backlight.c
src/login/logind-core.c
src/login/logind-session-device.c
src/login/logind.c
src/rfkill/rfkill.c

index 5579d8a..fb8e374 100644 (file)
@@ -88,7 +88,7 @@ static int same_device(sd_device *a, sd_device *b) {
         if (r < 0)
                 return r;
 
-        if (!streq_ptr(a_val, b_val))
+        if (!streq(a_val, b_val))
                 return false;
 
         r = sd_device_get_sysname(a, &a_val);
@@ -99,7 +99,7 @@ static int same_device(sd_device *a, sd_device *b) {
         if (r < 0)
                 return r;
 
-        return streq_ptr(a_val, b_val);
+        return streq(a_val, b_val);
 }
 
 static int validate_device(sd_device *device) {
index dac240d..d2351b9 100644 (file)
@@ -218,14 +218,14 @@ int manager_add_button(Manager *m, const char *name, Button **_button) {
 }
 
 int manager_process_seat_device(Manager *m, sd_device *d) {
-        const char *action = NULL;
+        const char *action;
         Device *device;
         int r;
 
         assert(m);
 
-        (void) sd_device_get_property_value(d, "ACTION", &action);
-        if (streq_ptr(action, "remove")) {
+        if (sd_device_get_property_value(d, "ACTION", &action) >= 0 &&
+            streq(action, "remove")) {
                 const char *syspath;
 
                 r = sd_device_get_syspath(d, &syspath);
@@ -285,7 +285,7 @@ int manager_process_seat_device(Manager *m, sd_device *d) {
 }
 
 int manager_process_button_device(Manager *m, sd_device *d) {
-        const char *action = NULL, *sysname;
+        const char *action, *sysname;
         Button *b;
         int r;
 
@@ -295,8 +295,8 @@ int manager_process_button_device(Manager *m, sd_device *d) {
         if (r < 0)
                 return r;
 
-        (void) sd_device_get_property_value(d, "ACTION", &action);
-        if (streq_ptr(action, "remove")) {
+        if (sd_device_get_property_value(d, "ACTION", &action) >= 0 &&
+            streq(action, "remove")) {
 
                 b = hashmap_get(m->buttons, sysname);
                 if (!b)
index fbba792..0b798cf 100644 (file)
@@ -255,10 +255,10 @@ static DeviceType detect_device_type(sd_device *dev) {
             sd_device_get_subsystem(dev, &subsystem) < 0)
                 return type;
 
-        if (streq_ptr(subsystem, "drm")) {
+        if (streq(subsystem, "drm")) {
                 if (startswith(sysname, "card"))
                         type = DEVICE_TYPE_DRM;
-        } else if (streq_ptr(subsystem, "input")) {
+        } else if (streq(subsystem, "input")) {
                 if (startswith(sysname, "event"))
                         type = DEVICE_TYPE_EVDEV;
         }
index b9ad100..e90c857 100644 (file)
@@ -580,7 +580,7 @@ static int manager_dispatch_vcsa_udev(sd_event_source *s, int fd, uint32_t reven
         if (sd_device_get_sysname(d, &name) >= 0 &&
             startswith(name, "vcsa") &&
             sd_device_get_property_value(d, "ACTION", &action) >= 0 &&
-            streq_ptr(action, "remove"))
+            streq(action, "remove"))
                 seat_preallocate_vts(m->seat0);
 
         return 0;
index 36b82a4..7939c2d 100644 (file)
@@ -149,7 +149,7 @@ static int wait_for_initialized(
                 if (r < 0)
                         continue;
 
-                if (sd_device_get_sysname(t, &name) >= 0 && streq_ptr(name, sysname)) {
+                if (sd_device_get_sysname(t, &name) >= 0 && streq(name, sysname)) {
                         *ret = TAKE_PTR(t);
                         return 0;
                 }