summaryrefslogtreecommitdiff
path: root/dev.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-20 23:51:48 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-20 23:51:48 +0200
commitbb59a298dd26f0d066c7ae755a9748384c952f43 (patch)
tree956c0c52437402591caf3a1dffdc3917d17917b9 /dev.c
parent833ab9522d510197270543e47868d86ec67db5aa (diff)
dev: mark paths likely/unlikely
Mark them as what is to be most expected. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'dev.c')
-rw-r--r--dev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dev.c b/dev.c
index ec27178..3e2e7af 100644
--- a/dev.c
+++ b/dev.c
@@ -79,7 +79,7 @@ int device_address(const char *ifname, int af, struct sockaddr_storage *ss)
ifr.ifr_addr.sa_family = af;
ret = ioctl(sock, SIOCGIFADDR, &ifr);
- if (!ret)
+ if (likely(!ret))
memcpy(ss, &ifr.ifr_addr, sizeof(ifr.ifr_addr));
close(sock);
@@ -97,7 +97,7 @@ int device_mtu(const char *ifname)
strlcpy(ifr.ifr_name, ifname, IFNAMSIZ);
ret = ioctl(sock, SIOCGIFMTU, &ifr);
- if (!ret)
+ if (likely(!ret))
mtu = ifr.ifr_mtu;
close(sock);
@@ -116,7 +116,7 @@ short device_get_flags(const char *ifname)
strlcpy(ifr.ifr_name, ifname, IFNAMSIZ);
ret = ioctl(sock, SIOCGIFFLAGS, &ifr);
- if (!ret)
+ if (likely(!ret))
flags = ifr.ifr_flags;
close(sock);
@@ -135,7 +135,7 @@ void device_set_flags(const char *ifname, const short flags)
ifr.ifr_flags = flags;
ret = ioctl(sock, SIOCSIFFLAGS, &ifr);
- if (ret < 0)
+ if (unlikely(ret < 0))
panic("Cannot set NIC flags!\n");
close(sock);