[libvirt] [PATCH 08/32] udevProcessSCSIHost: use STRSKIP

Ján Tomko jtomko at redhat.com
Mon Jun 6 09:01:45 UTC 2016


Instead of separating it into STRPEFIX and str + strlen.
---
 src/node_device/node_device_udev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 59bc452..7d111c4 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -712,16 +712,17 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
     int ret = -1;
     virNodeDevCapDataPtr data = &def->caps->data;
     char *filename = NULL;
+    char *str;
 
     filename = last_component(def->sysfs_path);
 
-    if (!STRPREFIX(filename, "host")) {
+    if (!(str = STRSKIP(filename, "host"))) {
         VIR_ERROR(_("SCSI host found, but its udev name '%s' does "
                     "not begin with 'host'"), filename);
         goto out;
     }
 
-    if (udevStrToLong_ui(filename + strlen("host"),
+    if (udevStrToLong_ui(str,
                          NULL,
                          0,
                          &data->scsi_host.host) == -1) {
-- 
2.7.3




More information about the libvir-list mailing list