stdio: fix warnings, make code more standard

Masking with _IO_CHMASK after the assignment causes a warning.
We're better off masking before, but casting the assignment to
prevent sign extension.
This commit is contained in:
Ori Bernstein 2020-07-19 14:14:14 -07:00
parent 9ea93a5fd3
commit 2d59d75e3a
2 changed files with 2 additions and 2 deletions

View file

@ -106,7 +106,7 @@ extern int getchar(void);
#define getchar() getc(stdin)
extern char *gets(char *);
extern int putc(int, FILE *);
#define putc(c, f) ((f)->wp>=(f)->rp?_IO_putc(c, f):((*(f)->wp++=(c))&_IO_CHMASK))
#define putc(c, f) ((f)->wp>=(f)->rp?_IO_putc(c, f):(*(unsigned char*)(f)->wp++=(c)&_IO_CHMASK))
extern int _IO_putc(int, FILE *);
extern int putchar(int);
#define putchar(c) putc(c, stdout)

View file

@ -92,7 +92,7 @@ int getchar(void);
#define getchar() getc(stdin)
char *gets(char *);
int putc(int, FILE *);
#define putc(c, f) ((f)->wp>=(f)->rp?_IO_putc(c, f):((*(f)->wp++=(c))&_IO_CHMASK))
#define putc(c, f) ((f)->wp>=(f)->rp?_IO_putc(c, f):(*(unsigned char*)(f)->wp++=(c)&_IO_CHMASK))
int _IO_putc(int, FILE *);
int putchar(int);
#define putchar(c) putc(c, stdout)