1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2 +++ b/devel/m4/patches/patch-update_freadahead Mon Jul 29 23:39:07 2013 -0400
4 +diff -r d1c9a158c955 lib/freadahead.c
5 +--- lib/freadahead.c Wed Mar 13 20:55:32 2013 +0000
6 ++++ lib/freadahead.c Wed Mar 13 20:56:08 2013 +0000
8 + /* Retrieve information about a FILE stream.
9 +- Copyright (C) 2007-2011 Free Software Foundation, Inc.
10 ++ Copyright (C) 2007-2013 Free Software Foundation, Inc.
12 + This program is free software: you can redistribute it and/or modify
13 + it under the terms of the GNU General Public License as published by
16 + #include "stdio-impl.h"
18 ++#ifndef HAVE___FREADAHEAD
20 + freadahead (FILE *fp)
23 + return (fp->_IO_read_end - fp->_IO_read_ptr)
24 + + (fp->_flags & _IO_IN_BACKUP ? fp->_IO_save_end - fp->_IO_save_base :
26 +-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
27 ++#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
28 + if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
30 + # if defined __DragonFly__
33 + (fp->_ungetc_count == 0 ? fp->_rcount : fp->_ungetc_count - fp->_rcount) */
34 + return (fp->_rcount > 0 ? fp->_rcount : fp->_ungetc_count - fp->_rcount);
35 ++#elif defined __minix /* Minix */
36 ++ if ((fp_->_flags & _IOWRITING) != 0)
38 ++ return fp_->_count;
39 + #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
40 + if ((fp_->_flag & _IOWRT) != 0)
43 + return (fp->__pushed_back
44 + ? fp->__get_limit - fp->__pushback_bufp + 1
45 + : fp->__get_limit - fp->__bufp);
46 ++#elif defined EPLAN9 /* Plan9 */
47 ++ if (fp->state == 4 /* WR */ || fp->rp >= fp->wp)
49 ++ return fp->wp - fp->rp;
50 + #elif defined SLOW_BUT_NO_HACKS /* users can define this */
54 + #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
58 +diff -r d1c9a158c955 lib/freadahead.h
59 +--- lib/freadahead.h Wed Mar 13 20:55:32 2013 +0000
60 ++++ lib/freadahead.h Wed Mar 13 20:56:08 2013 +0000
62 + /* Retrieve information about a FILE stream.
63 +- Copyright (C) 2007-2011 Free Software Foundation, Inc.
64 ++ Copyright (C) 2007-2013 Free Software Foundation, Inc.
66 + This program is free software: you can redistribute it and/or modify
67 + it under the terms of the GNU General Public License as published by
76 + /* Assuming the stream STREAM is open for reading:
77 + Return the number of bytes waiting in the input buffer of STREAM.
78 + This includes both the bytes that have been read from the underlying input
81 + STREAM must not be wide-character oriented. */
83 +-extern size_t freadahead (FILE *stream);
84 ++#if HAVE___FREADAHEAD || (defined(__linux__) && !defined(__GLIBC__) && !defined(__UCLIBC__)) /* musl libc */
85 ++#ifndef HAVE___FREADAHEAD
86 ++#define HAVE___FREADAHEAD 1
90 ++# include <stdio_ext.h>
91 ++# define freadahead(stream) __freadahead (stream)
99 ++extern size_t freadahead (FILE *stream) _GL_ATTRIBUTE_PURE;
101 ++# ifdef __cplusplus