]> xenbits.xensource.com Git - libvirt.git/commitdiff
Remove udevStrToLong_i
authorJán Tomko <jtomko@redhat.com>
Fri, 3 Jun 2016 12:58:51 +0000 (14:58 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 7 Jun 2016 10:00:36 +0000 (12:00 +0200)
Open code the error message.

src/node_device/node_device_udev.c

index 5b341d98b503f553fc209d8b91e050b30cccab0c..b1e733b204110346ccc78ddbbc07641a76c2a77e 100644 (file)
@@ -58,23 +58,6 @@ struct _udevPrivate {
 };
 
 
-static int udevStrToLong_i(char const *s,
-                           char **end_ptr,
-                           int base,
-                           int *result)
-{
-    int ret = 0;
-
-    ret = virStrToLong_i(s, end_ptr, base, result);
-    if (ret != 0) {
-        VIR_ERROR(_("Failed to convert '%s' to int"), s);
-    } else {
-        VIR_DEBUG("Converted '%s' to int %u", s, *result);
-    }
-
-    return ret;
-}
-
 /* This function allocates memory from the heap for the property
  * value.  That memory must be later freed by some other code. */
 static int udevGetDeviceProperty(struct udev_device *udev_device,
@@ -128,8 +111,10 @@ static int udevGetIntProperty(struct udev_device *udev_device,
     ret = udevGetDeviceProperty(udev_device, property_key, &udev_value);
 
     if (ret == PROPERTY_FOUND) {
-        if (udevStrToLong_i(udev_value, NULL, base, value) != 0)
+        if (virStrToLong_i(udev_value, NULL, base, value) < 0) {
+            VIR_ERROR(_("Failed to convert '%s' to int"), udev_value);
             ret = PROPERTY_ERROR;
+        }
     }
 
     VIR_FREE(udev_value);
@@ -229,8 +214,10 @@ static int udevGetIntSysfsAttr(struct udev_device *udev_device,
     ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);
 
     if (ret == PROPERTY_FOUND) {
-        if (udevStrToLong_i(udev_value, NULL, base, value) != 0)
+        if (virStrToLong_i(udev_value, NULL, base, value) < 0) {
+            VIR_ERROR(_("Failed to convert '%s' to int"), udev_value);
             ret = PROPERTY_ERROR;
+        }
     }
 
     VIR_FREE(udev_value);