autoupdate
[gnulib.git] / lib / freadseek.c
index 82fd648..23046fa 100644 (file)
@@ -1,5 +1,5 @@
 /* Skipping input from a FILE stream.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
 #include "freadahead.h"
 #include "freadptr.h"
 
+#include "stdio-impl.h"
+
 /* Increment the in-memory pointer.  INCREMENT must be at most the buffer size
    returned by freadptr().
    This is very cheap (no system calls).  */
@@ -32,30 +34,17 @@ static inline void
 freadptrinc (FILE *fp, size_t increment)
 {
   /* Keep this code in sync with freadptr!  */
-#if defined _IO_ferror_unlocked     /* GNU libc, BeOS */
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   fp->_IO_read_ptr += increment;
-#elif defined __sferror             /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
-  fp->_p += increment;
-  fp->_r -= increment;
+#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+  fp_->_p += increment;
+  fp_->_r -= increment;
+#elif defined __EMX__               /* emx+gcc */
+  fp->_ptr += increment;
+  fp->_rcount -= increment;
 #elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */
-# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
-#  define fp_ ((struct { unsigned char *_ptr; \
-                        unsigned char *_base; \
-                        unsigned char *_end; \
-                        long _cnt; \
-                        int _file; \
-                        unsigned int _flag; \
-                      } *) fp)
   fp_->_ptr += increment;
   fp_->_cnt -= increment;
-# else
-#  if defined _SCO_DS               /* OpenServer */
-#   define _ptr __ptr
-#   define _cnt __cnt
-#  endif
-  fp->_ptr += increment;
-  fp->_cnt -= increment;
-# endif
 #elif defined __UCLIBC__            /* uClibc */
 # ifdef __STDIO_BUFFERS
   fp->__bufpos += increment;
@@ -64,6 +53,9 @@ freadptrinc (FILE *fp, size_t increment)
 # endif
 #elif defined __QNX__               /* QNX */
   fp->_Next += increment;
+#elif defined __MINT__              /* Atari FreeMiNT */
+  fp->__bufp += increment;
+#elif defined SLOW_BUT_NO_HACKS     /* users can define this */
 #else
  #error "Please port gnulib freadseek.c to your platform! Look at the definition of getc, getc_unlocked on your system, then report this to bug-gnulib."
 #endif