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/stdio/fclose.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/stdio/fclose.c
diff --git a/fusl/src/stdio/fclose.c b/fusl/src/stdio/fclose.c
index d687a8779b64f2d46b8790165c695b9612d3cc0a..802982defe62380cb888fb1102c0b80926f32cdc 100644
--- a/fusl/src/stdio/fclose.c
+++ b/fusl/src/stdio/fclose.c
@@ -1,32 +1,37 @@
#include "stdio_impl.h"
#include "libc.h"
-static void dummy(FILE *f) { }
+static void dummy(FILE* f) {}
weak_alias(dummy, __unlist_locked_file);
-int fclose(FILE *f)
-{
- int r;
- int perm;
-
- FLOCK(f);
+int fclose(FILE* f) {
+ int r;
+ int perm;
- __unlist_locked_file(f);
+ FLOCK(f);
- if (!(perm = f->flags & F_PERM)) {
- FILE **head = __ofl_lock();
- if (f->prev) f->prev->next = f->next;
- if (f->next) f->next->prev = f->prev;
- if (*head == f) *head = f->next;
- __ofl_unlock();
- }
+ __unlist_locked_file(f);
- r = fflush(f);
- r |= f->close(f);
+ if (!(perm = f->flags & F_PERM)) {
+ FILE** head = __ofl_lock();
+ if (f->prev)
+ f->prev->next = f->next;
+ if (f->next)
+ f->next->prev = f->prev;
+ if (*head == f)
+ *head = f->next;
+ __ofl_unlock();
+ }
- if (f->getln_buf) free(f->getln_buf);
- if (!perm) free(f);
- else FUNLOCK(f);
+ r = fflush(f);
+ r |= f->close(f);
- return r;
+ if (f->getln_buf)
+ free(f->getln_buf);
+ if (!perm)
+ free(f);
+ else
+ FUNLOCK(f);
+
+ return r;
}

Powered by Google App Engine
This is Rietveld 408576698