mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
xen_common: Change xenConfigCopyStringInternal to use virConfGetValueString
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
efc29ab2e5
commit
db343ca830
@ -145,10 +145,13 @@ xenConfigCopyStringInternal(virConfPtr conf,
|
|||||||
char **value,
|
char **value,
|
||||||
int allowMissing)
|
int allowMissing)
|
||||||
{
|
{
|
||||||
virConfValuePtr val;
|
int rc;
|
||||||
|
|
||||||
*value = NULL;
|
*value = NULL;
|
||||||
if (!(val = virConfGetValue(conf, name))) {
|
if ((rc = virConfGetValueString(conf, name, value)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (rc == 0) {
|
||||||
if (allowMissing)
|
if (allowMissing)
|
||||||
return 0;
|
return 0;
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -156,20 +159,7 @@ xenConfigCopyStringInternal(virConfPtr conf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val->type != VIR_CONF_STRING) {
|
return 1;
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("config value %s was not a string"), name);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!val->str) {
|
|
||||||
if (allowMissing)
|
|
||||||
return 0;
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("config value %s was missing"), name);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return VIR_STRDUP(*value, val->str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user