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

Unified Diff: fusl/src/stdio/ungetwc.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/ungetwc.c
diff --git a/fusl/src/stdio/ungetwc.c b/fusl/src/stdio/ungetwc.c
index 80d6e203d0765564a21e016f8be9577f6a3c67a2..0ddfb76969d0ca981987883a501f4fbfbc6c1664 100644
--- a/fusl/src/stdio/ungetwc.c
+++ b/fusl/src/stdio/ungetwc.c
@@ -5,31 +5,34 @@
#include <ctype.h>
#include <string.h>
-wint_t ungetwc(wint_t c, FILE *f)
-{
- unsigned char mbc[MB_LEN_MAX];
- int l=1;
- locale_t *ploc = &CURRENT_LOCALE, loc = *ploc;
+wint_t ungetwc(wint_t c, FILE* f) {
+ unsigned char mbc[MB_LEN_MAX];
+ int l = 1;
+ locale_t *ploc = &CURRENT_LOCALE, loc = *ploc;
- FLOCK(f);
+ FLOCK(f);
- if (f->mode <= 0) fwide(f, 1);
- *ploc = f->locale;
+ if (f->mode <= 0)
+ fwide(f, 1);
+ *ploc = f->locale;
- if (!f->rpos) __toread(f);
- if (!f->rpos || f->rpos < f->buf - UNGET + l || c == WEOF ||
- (!isascii(c) && (l = wctomb((void *)mbc, c)) < 0)) {
- FUNLOCK(f);
- *ploc = loc;
- return WEOF;
- }
+ if (!f->rpos)
+ __toread(f);
+ if (!f->rpos || f->rpos < f->buf - UNGET + l || c == WEOF ||
+ (!isascii(c) && (l = wctomb((void*)mbc, c)) < 0)) {
+ FUNLOCK(f);
+ *ploc = loc;
+ return WEOF;
+ }
- if (isascii(c)) *--f->rpos = c;
- else memcpy(f->rpos -= l, mbc, l);
+ if (isascii(c))
+ *--f->rpos = c;
+ else
+ memcpy(f->rpos -= l, mbc, l);
- f->flags &= ~F_EOF;
+ f->flags &= ~F_EOF;
- FUNLOCK(f);
- *ploc = loc;
- return c;
+ FUNLOCK(f);
+ *ploc = loc;
+ return c;
}

Powered by Google App Engine
This is Rietveld 408576698