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

Side by Side Diff: fusl/src/stdio/fgetws.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 unified diff | Download patch
OLDNEW
1 #include "stdio_impl.h" 1 #include "stdio_impl.h"
2 #include <wchar.h> 2 #include <wchar.h>
3 3
4 wint_t __fgetwc_unlocked(FILE *); 4 wint_t __fgetwc_unlocked(FILE*);
5 5
6 wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f) 6 wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict f) {
7 { 7 wchar_t* p = s;
8 » wchar_t *p = s;
9 8
10 » if (!n--) return s; 9 if (!n--)
10 return s;
11 11
12 » FLOCK(f); 12 FLOCK(f);
13 13
14 » for (; n; n--) { 14 for (; n; n--) {
15 » » wint_t c = __fgetwc_unlocked(f); 15 wint_t c = __fgetwc_unlocked(f);
16 » » if (c == WEOF) break; 16 if (c == WEOF)
17 » » *p++ = c; 17 break;
18 » » if (c == '\n') break; 18 *p++ = c;
19 » } 19 if (c == '\n')
20 » *p = 0; 20 break;
21 » if (ferror(f)) p = s; 21 }
22 *p = 0;
23 if (ferror(f))
24 p = s;
22 25
23 » FUNLOCK(f); 26 FUNLOCK(f);
24 27
25 » return (p == s) ? NULL : s; 28 return (p == s) ? NULL : s;
26 } 29 }
27 30
28 weak_alias(fgetws, fgetws_unlocked); 31 weak_alias(fgetws, fgetws_unlocked);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698