mirror of git://git.musl-libc.org/musl
adjust types in FILE struct to make line buffering check less expensive
the choice of signed char for lbf was a theoretically space-saving
hack that was not helping, and was unwantedly expensive. while
comparing bytes against a byte-sized member sounds easy, the trick
here was that the byte to be compared was unsigned while the lbf
member was signed, making it possible to set lbf negative to disable
line buffering. however, this imposed a requirement to promote both
operands, zero-extending one and sign-extending the other, in order to
compare them.
to fix this, repurpose the waiters count slot (unused since commit
c21f750727
). while we're at it, switch
mode (orientation) from signed char to int as well. this makes no
semantic difference (its only possible values are -1, 0, and 1) but it
might help on archs where byte access is awkward.
This commit is contained in:
parent
d8870dcf38
commit
8084d6ab57
|
@ -34,11 +34,9 @@ struct _IO_FILE {
|
|||
int fd;
|
||||
int pipe_pid;
|
||||
long lockcount;
|
||||
short dummy3;
|
||||
signed char mode;
|
||||
signed char lbf;
|
||||
int mode;
|
||||
volatile int lock;
|
||||
volatile int waiters;
|
||||
int lbf;
|
||||
void *cookie;
|
||||
off_t off;
|
||||
char *getln_buf;
|
||||
|
|
Loading…
Reference in New Issue