Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1070)

Unified Diff: fusl/src/network/if_nametoindex.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fusl/src/network/if_nametoindex.c
diff --git a/fusl/src/network/if_nametoindex.c b/fusl/src/network/if_nametoindex.c
index 331413c68912daf5157988df60f3605c8d818750..02d23894ea21ab71f54e8f6d93bf4e2e692e968f 100644
--- a/fusl/src/network/if_nametoindex.c
+++ b/fusl/src/network/if_nametoindex.c
@@ -5,14 +5,14 @@
#include <string.h>
#include "syscall.h"
-unsigned if_nametoindex(const char *name)
-{
- struct ifreq ifr;
- int fd, r;
+unsigned if_nametoindex(const char* name) {
+ struct ifreq ifr;
+ int fd, r;
- if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return 0;
- strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
- r = ioctl(fd, SIOCGIFINDEX, &ifr);
- __syscall(SYS_close, fd);
- return r < 0 ? 0 : ifr.ifr_ifindex;
+ if ((fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
+ return 0;
+ strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
+ r = ioctl(fd, SIOCGIFINDEX, &ifr);
+ __syscall(SYS_close, fd);
+ return r < 0 ? 0 : ifr.ifr_ifindex;
}

Powered by Google App Engine
This is Rietveld 408576698