From 403660c508153a65ac3738b1f0884c74feb4acf6 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 1 Sep 2018 23:03:22 +0900 Subject: [PATCH] tree-wide: use streq() instead of streq_ptr() --- src/backlight/backlight.c | 4 ++-- src/login/logind-core.c | 12 ++++++------ src/login/logind-session-device.c | 4 ++-- src/login/logind.c | 2 +- src/rfkill/rfkill.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c index 5579d8a..fb8e374 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -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) { diff --git a/src/login/logind-core.c b/src/login/logind-core.c index dac240d..d2351b9 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -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) diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c index fbba792..0b798cf 100644 --- a/src/login/logind-session-device.c +++ b/src/login/logind-session-device.c @@ -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; } diff --git a/src/login/logind.c b/src/login/logind.c index b9ad100..e90c857 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -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; diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c index 36b82a4..7939c2d 100644 --- a/src/rfkill/rfkill.c +++ b/src/rfkill/rfkill.c @@ -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; } -- 2.7.4