提交 5da6615b 编写于 作者: M Mao Zhongyi 提交者: Cole Robinson

conf/network_conf: 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: NCole Robinson <crobinso@redhat.com>
Signed-off-by: NMao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: NZhang Shengju <zhangshengju@cmss.chinamobile.com>
Acked-by: NMichal Privoznik <mprivozn@redhat.com>
上级 7ae802eb
......@@ -1682,9 +1682,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
*/
ipv6nogwStr = virXPathString("string(./@ipv6)", ctxt);
if (ipv6nogwStr) {
if (STREQ(ipv6nogwStr, "yes")) {
def->ipv6nogw = true;
} else if (STRNEQ(ipv6nogwStr, "no")) {
if (virStringParseYesNo(ipv6nogwStr, &def->ipv6nogw) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("Invalid ipv6 setting '%s' in network '%s'"),
ipv6nogwStr, def->name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册