| 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;
|
| }
|
|
|