projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor stdio open file list handling, move it out of global libc struct
[musl]
/
src
/
stdio
/
fflush.c
diff --git
a/src/stdio/fflush.c
b/src/stdio/fflush.c
index
4c1647b
..
3f462c8
100644
(file)
--- a/
src/stdio/fflush.c
+++ b/
src/stdio/fflush.c
@@
-15,20
+15,16
@@
static int __fflush_unlocked(FILE *f)
f->wpos = f->wbase = f->wend = 0;
f->rpos = f->rend = 0;
f->wpos = f->wbase = f->wend = 0;
f->rpos = f->rend = 0;
- /* Hook for special behavior on flush */
- if (f->flush) f->flush(f);
-
return 0;
}
/* stdout.c will override this if linked */
return 0;
}
/* stdout.c will override this if linked */
-static FILE *
const
dummy = 0;
+static FILE *
volatile
dummy = 0;
weak_alias(dummy, __stdout_used);
int fflush(FILE *f)
{
int r;
weak_alias(dummy, __stdout_used);
int fflush(FILE *f)
{
int r;
- FILE *next;
if (f) {
FLOCK(f);
if (f) {
FLOCK(f);
@@
-39,16
+35,12
@@
int fflush(FILE *f)
r = __stdout_used ? fflush(__stdout_used) : 0;
r = __stdout_used ? fflush(__stdout_used) : 0;
- OFLLOCK();
- for (f=libc.ofl_head; f; f=next) {
+ for (f=*__ofl_lock(); f; f=f->next) {
FLOCK(f);
FLOCK(f);
- //OFLUNLOCK();
if (f->wpos > f->wbase) r |= __fflush_unlocked(f);
if (f->wpos > f->wbase) r |= __fflush_unlocked(f);
- //OFLLOCK();
- next = f->next;
FUNLOCK(f);
}
FUNLOCK(f);
}
-
OFLUNLOCK
();
+
__ofl_unlock
();
return r;
}
return r;
}