summaryrefslogtreecommitdiff
path: root/05/musl-0.6.0/src/stdio/fputc.c
blob: 3e0f738cf1636fc531af99c6df0391cb77bf59cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "stdio_impl.h"

int fputc(int c, FILE *f)
{
	FLOCK(f);
	if (c != f->lbf && f->wpos + 1 < f->wend) *f->wpos++ = c;
	else c = __overflow(f, c);
	FUNLOCK(f);
	return c;
}

int fputc_unlocked(int c, FILE *f)
{
	FLOCK(f);
	if (c != f->lbf && f->wpos + 1 < f->wend) *f->wpos++ = c;
	else c = __overflow(f, c);
	FUNLOCK(f);
	return c;
}