summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluokai <454728735@qq.com>2022-02-21 13:36:52 +0800
committerThomas Haller <thaller@redhat.com>2022-02-22 09:11:47 +0100
commitd5eb873eec1615159a0dc0ecd6662a64f5cb5bd1 (patch)
tree7a27e3caea74eea52abf32f5f657d546bb616ab0
parente730769208261149031958b3e713978e5729b92f (diff)
downloadNetworkManager-d5eb873eec1615159a0dc0ecd6662a64f5cb5bd1.tar.gz
platform: use switch statement in _linktype_get_type() for better readability
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1110
-rw-r--r--src/libnm-platform/nm-linux-platform.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index f87182936a..e3cc7a4dbc 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -1114,20 +1114,22 @@ _linktype_get_type(NMPlatform *platform,
return link_type;
}
- if (arptype == ARPHRD_LOOPBACK)
+ switch (arptype) {
+ case ARPHRD_LOOPBACK:
return NM_LINK_TYPE_LOOPBACK;
- else if (arptype == ARPHRD_INFINIBAND)
+ case ARPHRD_INFINIBAND:
return NM_LINK_TYPE_INFINIBAND;
- else if (arptype == ARPHRD_SIT)
+ case ARPHRD_SIT:
return NM_LINK_TYPE_SIT;
- else if (arptype == ARPHRD_TUNNEL6)
+ case ARPHRD_TUNNEL6:
return NM_LINK_TYPE_IP6TNL;
- else if (arptype == ARPHRD_PPP)
+ case ARPHRD_PPP:
return NM_LINK_TYPE_PPP;
- else if (arptype == ARPHRD_IEEE802154)
+ case ARPHRD_IEEE802154:
return NM_LINK_TYPE_WPAN;
- else if (arptype == ARPHRD_6LOWPAN)
+ case ARPHRD_6LOWPAN:
return NM_LINK_TYPE_6LOWPAN;
+ }
{
NMPUtilsEthtoolDriverInfo driver_info;