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

Unified Diff: fusl/src/unistd/gethostname.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/unistd/gethostname.c
diff --git a/fusl/src/unistd/gethostname.c b/fusl/src/unistd/gethostname.c
index f984b7dd2f9a88dde7fb23132424f912c17bcdc0..64b2e444d886dbab3d55656355c74bb11a33c576 100644
--- a/fusl/src/unistd/gethostname.c
+++ b/fusl/src/unistd/gethostname.c
@@ -1,13 +1,16 @@
#include <unistd.h>
#include <sys/utsname.h>
-int gethostname(char *name, size_t len)
-{
- size_t i;
- struct utsname uts;
- if (uname(&uts)) return -1;
- if (len > sizeof uts.nodename) len = sizeof uts.nodename;
- for (i=0; i<len && (name[i] = uts.nodename[i]); i++);
- if (i==len) name[i-1] = 0;
- return 0;
+int gethostname(char* name, size_t len) {
+ size_t i;
+ struct utsname uts;
+ if (uname(&uts))
+ return -1;
+ if (len > sizeof uts.nodename)
+ len = sizeof uts.nodename;
+ for (i = 0; i < len && (name[i] = uts.nodename[i]); i++)
+ ;
+ if (i == len)
+ name[i - 1] = 0;
+ return 0;
}

Powered by Google App Engine
This is Rietveld 408576698