mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
qemu/qemu_migration_params: use virStringParseYesNo helper
A function virStringParseYesNo was added to convert string 'yes' to true and 'no' to false, so use this helper to replace 'STREQ(.*, \"yes\")' and 'STREQ(.*, \"no\")' as it allows us to drop several repetitive if-then-else string->bool conversion blocks. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
This commit is contained in:
parent
5da6615baf
commit
35e1547870
@ -1319,12 +1319,7 @@ qemuMigrationParamsParse(xmlXPathContextPtr ctxt,
|
||||
break;
|
||||
|
||||
case QEMU_MIGRATION_PARAM_TYPE_BOOL:
|
||||
if (STREQ(value, "yes"))
|
||||
pv->value.b = true;
|
||||
else if (STREQ(value, "no"))
|
||||
pv->value.b = false;
|
||||
else
|
||||
rc = -1;
|
||||
rc = virStringParseYesNo(value, &pv->value.b);
|
||||
break;
|
||||
|
||||
case QEMU_MIGRATION_PARAM_TYPE_STRING:
|
||||
|
Loading…
x
Reference in New Issue
Block a user