summaryrefslogtreecommitdiff
path: root/lib/freadahead.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2012-06-19 23:35:08 +0200
committerBruno Haible <bruno@clisp.org>2012-06-19 23:35:08 +0200
commit2b14f42b44f04bce5631269ed46cd8be2413ccec (patch)
tree429bada82d83dc604d674a02cb621cb00494a3e8 /lib/freadahead.h
parent81c71120400c0f49c1429bf4b5d5ad89c151123a (diff)
downloadgnulib-2b14f42b44f04bce5631269ed46cd8be2413ccec.tar.gz
stdioext: Add support for musl libc.
* m4/fbufmode.m4 (gl_FUNC_FBUFMODE): Test whether __fbufsize exists. * lib/fbufmode.c (fbufmode): Add conditional code for musl. * m4/fseterr.m4: New file. * lib/fseterr.h (fseterr): Define as an alias of __fseterr if that function exists. * modules/fseterr (Files): Add m4/fseterr.m4. (configure.ac): Invoke gl_FUNC_FSETERR. Compile fseterr.c if __fseterr does not exist. (Makefile.am): Remove fseterr.c from lib_SOURCES. * lib/freadable.h: Update comment. * lib/fwritable.h: Update comment. * lib/freading.h: Update comment. * lib/fwriting.h: Update comment. * m4/freadahead.m4: New file. * lib/freadahead.h (freadahead): Define as an alias of __freadahead if that function exists. * modules/freadahead (Files): Add m4/freadahead.m4. (configure.ac): Invoke gl_FUNC_FREADAHEAD. Compile freadahead.c if __freadahead does not exist. (Makefile.am): Remove freadahead.c from lib_SOURCES. * m4/freadptr.m4: New file. * lib/freadptr.h (freadptr): Define as an alias of __freadptr if that function exists. * modules/freadptr (Files): Add m4/freadptr.m4. (configure.ac): Invoke gl_FUNC_FREADPTR. Compile freadptr.c if __freadptr does not exist. (Makefile.am): Remove freadptr.c from lib_SOURCES. * m4/freadseek.m4: New file. * lib/freadseek.c (freadptrinc): Use __freadptrinc if that function exists. * modules/freadseek (Files): Add m4/freadseek.m4. (configure.ac): Invoke gl_FUNC_FREADSEEK. * lib/fpurge.c (fpurge): Update comment. Reported by and with help from Rich Felker <dalias@aerifal.cx>.
Diffstat (limited to 'lib/freadahead.h')
-rw-r--r--lib/freadahead.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/freadahead.h b/lib/freadahead.h
index d87460243d..49eb00df69 100644
--- a/lib/freadahead.h
+++ b/lib/freadahead.h
@@ -17,10 +17,6 @@
#include <stddef.h>
#include <stdio.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Assuming the stream STREAM is open for reading:
Return the number of bytes waiting in the input buffer of STREAM.
This includes both the bytes that have been read from the underlying input
@@ -31,8 +27,21 @@ extern "C" {
STREAM must not be wide-character oriented. */
+#if HAVE___FREADAHEAD /* musl libc */
+
+# include <stdio_ext.h>
+# define freadahead(stream) __freadahead (stream)
+
+#else
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
extern size_t freadahead (FILE *stream) _GL_ATTRIBUTE_PURE;
-#ifdef __cplusplus
+# ifdef __cplusplus
}
+# endif
+
#endif