Avoid macro redefinition warnings.
[gnulib.git] / lib / freadptr.c
index 02b79e1..b47e09f 100644 (file)
@@ -37,14 +37,14 @@ freadptr (FILE *fp, size_t *sizep)
     return NULL;
   *sizep = size;
   return (const char *) fp->_IO_read_ptr;
-#elif defined __sferror             /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
-  if ((fp->_flags & __SWR) != 0 || fp->_r < 0)
+#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+  if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
     return NULL;
-  size = fp->_r;
+  size = fp_->_r;
   if (size == 0)
     return NULL;
   *sizep = size;
-  return (const char *) fp->_p;
+  return (const char *) fp_->_p;
 #elif defined __EMX__               /* emx+gcc */
   if ((fp->_flags & _IOWRT) != 0)
     return NULL;
@@ -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