changeset 30095:fea4dcfb54ee

Add conditional code for SLOW_BUT_NO_HACKS.
author Bruno Haible <bruno@clisp.org>
date Sat, 06 Sep 2008 13:58:21 +0200
parents 61428eda852d
children 6cd1ef19e6ee
files ChangeLog lib/freadahead.c lib/freadptr.c lib/freadseek.c
diffstat 4 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Sep 06 12:12:41 2008 +0200
+++ b/ChangeLog	Sat Sep 06 13:58:21 2008 +0200
@@ -1,3 +1,10 @@
+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+.
--- a/lib/freadahead.c	Sat Sep 06 12:12:41 2008 +0200
+++ b/lib/freadahead.c	Sat Sep 06 13:58:21 2008 +0200
@@ -19,6 +19,7 @@
 /* Specification.  */
 #include "freadahead.h"
 
+#include <stdlib.h>
 #include "stdio-impl.h"
 
 size_t
@@ -69,6 +70,9 @@
 	 + (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
--- a/lib/freadptr.c	Sat Sep 06 12:12:41 2008 +0200
+++ b/lib/freadptr.c	Sat Sep 06 13:58:21 2008 +0200
@@ -85,6 +85,10 @@
     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
--- a/lib/freadseek.c	Sat Sep 06 12:12:41 2008 +0200
+++ b/lib/freadseek.c	Sat Sep 06 13:58:21 2008 +0200
@@ -53,6 +53,7 @@
 # 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