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:
Mao Zhongyi 2019-10-17 11:19:33 +08:00 committed by Cole Robinson
parent 5da6615baf
commit 35e1547870

View File

@ -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: