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

Side by Side Diff: fusl/src/stdio/fgetws.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « fusl/src/stdio/fgetwc.c ('k') | fusl/src/stdio/fileno.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "stdio_impl.h"
2 #include <wchar.h>
3
4 wint_t __fgetwc_unlocked(FILE *);
5
6 wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict f)
7 {
8 wchar_t *p = s;
9
10 if (!n--) return s;
11
12 FLOCK(f);
13
14 for (; n; n--) {
15 wint_t c = __fgetwc_unlocked(f);
16 if (c == WEOF) break;
17 *p++ = c;
18 if (c == '\n') break;
19 }
20 *p = 0;
21 if (ferror(f)) p = s;
22
23 FUNLOCK(f);
24
25 return (p == s) ? NULL : s;
26 }
27
28 weak_alias(fgetws, fgetws_unlocked);
OLDNEW
« no previous file with comments | « fusl/src/stdio/fgetwc.c ('k') | fusl/src/stdio/fileno.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698