On 2/18/19 2:09 PM, Julio Faracco wrote: > The structure used to handle network entries was based on 'if,else' > conditions. This commit converts this ugly structure into a switch to > clearify each option of the handler. > > Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx> > --- > src/lxc/lxc_native.c | 58 ++++++++++++++++++++++++++++++++------------ > src/lxc/lxc_native.h | 17 +++++++++++++ > 2 files changed, 59 insertions(+), 16 deletions(-) > > diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c > index 25e35e93dd..c746c443da 100644 > --- a/src/lxc/lxc_native.c > +++ b/src/lxc/lxc_native.c > @@ -35,6 +35,20 @@ > > VIR_LOG_INIT("lxc.lxc_native"); > > +VIR_ENUM_IMPL(virLXCNetworkConfigEntry, VIR_LXC_NETWORK_CONFIG_LAST, > + "name", > + "type", > + "link", > + "hwaddr", > + "flags", > + "macvlan.mode", > + "vlan.id", > + "ipv4", > + "ipv4.gateway", > + "ipv6", > + "ipv6.gateway" > +); > + > static virDomainFSDefPtr > lxcCreateFSDef(int type, > const char *src, > @@ -620,35 +634,47 @@ lxcNetworkParseDataIPs(const char *name, virConfValuePtr value, lxcNetworkParseD > } > > static int > -lxcNetworkParseDataSuffix(const char *name, virConfValuePtr value, lxcNetworkParseData *parseData) > +lxcNetworkParseDataSuffix(const char *entry, virConfValuePtr value, lxcNetworkParseData *parseData) same w/r/t empty lines and argument on each line. > { > - if (STREQ(name, "type")) { > + int type = virLXCNetworkConfigEntryTypeFromString(entry); s/int type/int elem/ @entry was another option, but @elem I think is better than @type since "type" is a field. Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx> John [...] -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list