mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virInterfaceDefParseProtoIPv4: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
86cfd4d4e8
commit
f4b970dc2a
@ -266,10 +266,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDef *def,
|
|||||||
g_autofree xmlNodePtr *ipNodes = NULL;
|
g_autofree xmlNodePtr *ipNodes = NULL;
|
||||||
int nipNodes;
|
int nipNodes;
|
||||||
size_t i;
|
size_t i;
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
|
def->gateway = virXPathString("string(./route[1]/@gateway)", ctxt);
|
||||||
def->gateway = tmp;
|
|
||||||
|
|
||||||
dhcp = virXPathNode("./dhcp", ctxt);
|
dhcp = virXPathNode("./dhcp", ctxt);
|
||||||
if (dhcp != NULL) {
|
if (dhcp != NULL) {
|
||||||
@ -287,10 +285,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDef *def,
|
|||||||
|
|
||||||
def->nips = 0;
|
def->nips = 0;
|
||||||
for (i = 0; i < nipNodes; i++) {
|
for (i = 0; i < nipNodes; i++) {
|
||||||
|
virInterfaceIPDef *ip = g_new0(virInterfaceIPDef, 1);
|
||||||
virInterfaceIPDef *ip;
|
|
||||||
|
|
||||||
ip = g_new0(virInterfaceIPDef, 1);
|
|
||||||
|
|
||||||
if (virInterfaceDefParseIP(ip, ipNodes[i]) < 0) {
|
if (virInterfaceDefParseIP(ip, ipNodes[i]) < 0) {
|
||||||
virInterfaceIPDefFree(ip);
|
virInterfaceIPDefFree(ip);
|
||||||
|
Loading…
Reference in New Issue
Block a user