about summary refs log tree commit diff
path: root/libio/stdio.h
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-02-05 14:42:29 -0500
committerZack Weinberg <zackw@panix.com>2018-02-05 19:59:03 -0500
commit26c07172cde74617ca7214c93cdcfa75321e6b2b (patch)
tree27828020addf2f8ee8b44801169428b1e149f38f /libio/stdio.h
parentde6da571eeff41e69a28744b4c57e219828e26bc (diff)
downloadglibc-26c07172cde74617ca7214c93cdcfa75321e6b2b.tar.gz
glibc-26c07172cde74617ca7214c93cdcfa75321e6b2b.tar.xz
glibc-26c07172cde74617ca7214c93cdcfa75321e6b2b.zip
Remove getc and putc macros from the public stdio.h.
The getc and putc macros in the public stdio.h expand to call _IO_getc
and _IO_putc respectively.  As _IO_getc, fgetc, and getc are all aliases
for the same function, and _IO_putc, fputc, and putc are also all aliases
for the same function, the macros are pointless.  The C standard does
not require getc and putc to be macros, so let's just not have macros.
All four symbols are exported from libc.so at the same, ancient symbol
version, so there should be no risks for binary compatibility.  Similarly,
the getchar and putchar inlines in bits/stdio.h forward to getc and putc
instead of their _IO_ aliases.

As a change from longstanding historical practice, this does seem
like it might break _something_, so there is a note in NEWS, which
is also a convenient place to advise people that if they thought getc
and putc had reduced per-character overhead they should consider using
getc_unlocked and putc_unlocked instead.  (These are also not macros,
but when optimizing, they are inlines.)

	* libio/stdio.h: Don't define getc or putc as macros.
	* libio/bits/stdio.h (getchar, putchar): Use getc and putc,
	not _IO_getc and _IO_putc.
Diffstat (limited to 'libio/stdio.h')
-rw-r--r--libio/stdio.h8
1 files changed, 0 insertions, 8 deletions
diff --git a/libio/stdio.h b/libio/stdio.h
index 95bc902a82..33de3813bb 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -483,10 +483,6 @@ extern int getc (FILE *__stream);
    marked with __THROW.  */
 extern int getchar (void);
 
-/* The C standard explicitly says this is a macro, so we always do the
-   optimization for it.  */
-#define getc(_fp) _IO_getc (_fp)
-
 #ifdef __USE_POSIX199506
 /* These are defined in POSIX.1:1996.
 
@@ -523,10 +519,6 @@ extern int putc (int __c, FILE *__stream);
    marked with __THROW.  */
 extern int putchar (int __c);
 
-/* The C standard explicitly says this can be a macro,
-   so we always do the optimization for it.  */
-#define putc(_ch, _fp) _IO_putc (_ch, _fp)
-
 #ifdef __USE_MISC
 /* Faster version when locking is not necessary.