Add conditional code for SLOW_BUT_NO_HACKS.
authorBruno Haible <bruno@clisp.org>
Sat, 6 Sep 2008 11:58:21 +0000 (13:58 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 6 Sep 2008 11:58:21 +0000 (13:58 +0200)
ChangeLog
lib/freadahead.c
lib/freadptr.c
lib/freadseek.c

index 460c4d3..b2a0e2d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-09-06  Bruno Haible  <bruno@clisp.org>
 
+       * lib/freadahead.c (freadahead): Add conditional for SLOW_BUT_NO_HACKS.
+       * lib/freadptr.c (freadptr): Likewise.
+       * lib/freadseek.c (freadptrinc): Likewise.
+       Reported by Simon Josefsson.
+
+2008-09-06  Bruno Haible  <bruno@clisp.org>
+
        * modules/freadptr (License): Change to LGPLv2+.
        * modules/freadseek (License): Likewise.
        Suggested by Eric Blake.
index 15cc708..2dcf81c 100644 (file)
@@ -19,6 +19,7 @@
 /* Specification.  */
 #include "freadahead.h"
 
+#include <stdlib.h>
 #include "stdio-impl.h"
 
 size_t
@@ -69,6 +70,9 @@ freadahead (FILE *fp)
         + (fp->_Mode & 0x4000 /* _MBYTE */
            ? (fp->_Back + sizeof (fp->_Back)) - fp->_Rback
            : 0);
+#elif defined SLOW_BUT_NO_HACKS     /* users can define this */
+  abort ();
+  return 0;
 #else
  #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."
 #endif
index 6e08b48..b47e09f 100644 (file)
@@ -85,6 +85,10 @@ freadptr (FILE *fp, size_t *sizep)
     return NULL;
   *sizep = size;
   return (const char *) fp->_Next;
+#elif defined SLOW_BUT_NO_HACKS     /* users can define this */
+  /* This implementation is correct on any ANSI C platform.  It is just
+     awfully slow.  */
+  return NULL;
 #else
  #error "Please port gnulib freadptr.c to your platform! Look at the definition of fflush, fread, getc, getc_unlocked on your system, then report this to bug-gnulib."
 #endif
index f56f8b1..4299e82 100644 (file)
@@ -53,6 +53,7 @@ freadptrinc (FILE *fp, size_t increment)
 # endif
 #elif defined __QNX__               /* QNX */
   fp->_Next += 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