summaryrefslogtreecommitdiff
path: root/package/m4/patches/patch-lib_freadahead_h
blob: fa7a8a1fa64be24ea1a917506f51dd208b826fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- m4-1.4.16.orig/lib/freadahead.h	2011-03-01 17:39:27.000000000 +0100
+++ m4-1.4.16/lib/freadahead.h	2013-09-04 13:59:50.000000000 +0200
@@ -17,9 +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.
@@ -31,8 +28,25 @@ extern "C" {
 
    STREAM must not be wide-character oriented.  */
 
+
+#if HAVE___FREADAHEAD || (defined(__linux__) && !defined(__GLIBC__) && !defined(__UCLIBC__)) /* musl libc */
+#ifndef HAVE___FREADAHEAD
+#define HAVE___FREADAHEAD 1
+#endif
+
+#include <stdio_ext.h>
+#define freadahead(stream) __freadahead (stream)
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern size_t freadahead (FILE *stream);
 
 #ifdef __cplusplus
 }
 #endif
+
+#endif