mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Remove udevStrToLong_i
Open code the error message.
This commit is contained in:
parent
07202bf4cf
commit
fde3a38e03
@ -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
|
/* This function allocates memory from the heap for the property
|
||||||
* value. That memory must be later freed by some other code. */
|
* value. That memory must be later freed by some other code. */
|
||||||
static int udevGetDeviceProperty(struct udev_device *udev_device,
|
static int udevGetDeviceProperty(struct udev_device *udev_device,
|
||||||
@ -128,9 +111,11 @@ static int udevGetIntProperty(struct udev_device *udev_device,
|
|||||||
ret = udevGetDeviceProperty(udev_device, property_key, &udev_value);
|
ret = udevGetDeviceProperty(udev_device, property_key, &udev_value);
|
||||||
|
|
||||||
if (ret == PROPERTY_FOUND) {
|
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;
|
ret = PROPERTY_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VIR_FREE(udev_value);
|
VIR_FREE(udev_value);
|
||||||
return ret;
|
return ret;
|
||||||
@ -229,9 +214,11 @@ static int udevGetIntSysfsAttr(struct udev_device *udev_device,
|
|||||||
ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);
|
ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &udev_value);
|
||||||
|
|
||||||
if (ret == PROPERTY_FOUND) {
|
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;
|
ret = PROPERTY_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VIR_FREE(udev_value);
|
VIR_FREE(udev_value);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user