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

Unified Diff: fusl/src/misc/mntent.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/misc/mntent.c
diff --git a/fusl/src/misc/mntent.c b/fusl/src/misc/mntent.c
index a16d65254d5042df3de28ff29dc719ccecc76bc5..1c647641cbad9892c1f99a4cfc702783b8f2b32a 100644
--- a/fusl/src/misc/mntent.c
+++ b/fusl/src/misc/mntent.c
@@ -3,66 +3,66 @@
#include <mntent.h>
#include <errno.h>
-FILE *setmntent(const char *name, const char *mode)
-{
- return fopen(name, mode);
+FILE* setmntent(const char* name, const char* mode) {
+ return fopen(name, mode);
}
-int endmntent(FILE *f)
-{
- if (f) fclose(f);
- return 1;
+int endmntent(FILE* f) {
+ if (f)
+ fclose(f);
+ return 1;
}
-struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen)
-{
- int cnt, n[8];
+struct mntent* getmntent_r(FILE* f,
+ struct mntent* mnt,
+ char* linebuf,
+ int buflen) {
+ int cnt, n[8];
- mnt->mnt_freq = 0;
- mnt->mnt_passno = 0;
+ mnt->mnt_freq = 0;
+ mnt->mnt_passno = 0;
- do {
- fgets(linebuf, buflen, f);
- if (feof(f) || ferror(f)) return 0;
- if (!strchr(linebuf, '\n')) {
- fscanf(f, "%*[^\n]%*[\n]");
- errno = ERANGE;
- return 0;
- }
- cnt = sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d",
- n, n+1, n+2, n+3, n+4, n+5, n+6, n+7,
- &mnt->mnt_freq, &mnt->mnt_passno);
- } while (cnt < 2 || linebuf[n[0]] == '#');
+ do {
+ fgets(linebuf, buflen, f);
+ if (feof(f) || ferror(f))
+ return 0;
+ if (!strchr(linebuf, '\n')) {
+ fscanf(f, "%*[^\n]%*[\n]");
+ errno = ERANGE;
+ return 0;
+ }
+ cnt = sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d", n, n + 1,
+ n + 2, n + 3, n + 4, n + 5, n + 6, n + 7, &mnt->mnt_freq,
+ &mnt->mnt_passno);
+ } while (cnt < 2 || linebuf[n[0]] == '#');
- linebuf[n[1]] = 0;
- linebuf[n[3]] = 0;
- linebuf[n[5]] = 0;
- linebuf[n[7]] = 0;
+ linebuf[n[1]] = 0;
+ linebuf[n[3]] = 0;
+ linebuf[n[5]] = 0;
+ linebuf[n[7]] = 0;
- mnt->mnt_fsname = linebuf+n[0];
- mnt->mnt_dir = linebuf+n[2];
- mnt->mnt_type = linebuf+n[4];
- mnt->mnt_opts = linebuf+n[6];
+ mnt->mnt_fsname = linebuf + n[0];
+ mnt->mnt_dir = linebuf + n[2];
+ mnt->mnt_type = linebuf + n[4];
+ mnt->mnt_opts = linebuf + n[6];
- return mnt;
+ return mnt;
}
-struct mntent *getmntent(FILE *f)
-{
- static char linebuf[256];
- static struct mntent mnt;
- return getmntent_r(f, &mnt, linebuf, sizeof linebuf);
+struct mntent* getmntent(FILE* f) {
+ static char linebuf[256];
+ static struct mntent mnt;
+ return getmntent_r(f, &mnt, linebuf, sizeof linebuf);
}
-int addmntent(FILE *f, const struct mntent *mnt)
-{
- if (fseek(f, 0, SEEK_END)) return 1;
- return fprintf(f, "%s\t%s\t%s\t%s\t%d\t%d\n",
- mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type, mnt->mnt_opts,
- mnt->mnt_freq, mnt->mnt_passno) < 0;
+int addmntent(FILE* f, const struct mntent* mnt) {
+ if (fseek(f, 0, SEEK_END))
+ return 1;
+ return fprintf(f, "%s\t%s\t%s\t%s\t%d\t%d\n", mnt->mnt_fsname, mnt->mnt_dir,
+ mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq,
+ mnt->mnt_passno) < 0;
}
-char *hasmntopt(const struct mntent *mnt, const char *opt)
-{
- return strstr(mnt->mnt_opts, opt);
+char* hasmntopt(const struct mntent* mnt, const char* opt) {
+ return strstr(mnt->mnt_opts, opt);
}

Powered by Google App Engine
This is Rietveld 408576698