changeset 21856:e268886eb13d

Split fseeko.c into fseeko.c and ftello.c, move #ifdefs into the build system.
author diego
date Wed, 10 Jan 2007 19:35:41 +0000
parents 936209c39ed1
children 8d9e6b4fbf4d
files configure osdep/Makefile osdep/fseeko.c osdep/ftello.c
diffstat 4 files changed, 28 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Jan 10 19:07:42 2007 +0000
+++ b/configure	Wed Jan 10 19:35:41 2007 +0000
@@ -3439,8 +3439,10 @@
 cc_check && _fseeko=yes
 if test "$_fseeko" = yes ; then
  _def_fseeko='#define HAVE_FSEEKO 1'
+ _need_fseeko=no
 else
  _def_fseeko='#undef HAVE_FSEEKO'
+ _need_fseeko=yes
 fi
 echores "$_fseeko"
 
@@ -7234,8 +7236,10 @@
 cc_check && _ftello=yes
 if test "$_ftello" = yes ; then
  _def_ftello='#define HAVE_FTELLO 1'
+ _need_ftello=no
 else
  _def_ftello='#undef HAVE_FTELLO'
+ _need_ftello=yes
 fi
 echores "$_ftello"
 
@@ -7479,6 +7483,8 @@
 
 HAVE_SYS_MMAN_H = _mman
 
+NEED_FSEEKO  = $_need_fseeko
+NEED_FTELLO  = $_need_ftello
 NEED_GLOB    = $_need_glob
 NEED_SCANDIR = $_need_scandir
 NEED_SETENV  = $_need_setenv
--- a/osdep/Makefile	Wed Jan 10 19:07:42 2007 +0000
+++ b/osdep/Makefile	Wed Jan 10 19:35:41 2007 +0000
@@ -4,7 +4,6 @@
 LIBNAME = libosdep.a
 
 SRCS= strl.c \
-      fseeko.c \
 
 SRCS-$(HAVE_SYS_MMAN_H)       += mmap_anon.c
 SRCS-$(MACOSX_FINDER_SUPPORT) += macosx_finder_args.c
@@ -12,6 +11,8 @@
 SRCS-$(STREAM_CACHE)          += shmem.c
 endif
 
+SRCS-$(NEED_FSEEKO)           += fseeko.c
+SRCS-$(NEED_FTELLO)           += ftello.c
 SRCS-$(NEED_GETTIMEOFDAY)     += gettimeofday.c
 SRCS-$(NEED_SCANDIR)          += scandir.c
 SRCS-$(NEED_SETENV)           += setenv.c
--- a/osdep/fseeko.c	Wed Jan 10 19:07:42 2007 +0000
+++ b/osdep/fseeko.c	Wed Jan 10 19:35:41 2007 +0000
@@ -4,13 +4,11 @@
  */
 
 #include "config.h"
- 
-#if !defined(HAVE_FSEEKO) || !defined(HAVE_FTELLO)
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
-#endif
 
 #ifdef WIN32
 #define flockfile
@@ -25,7 +23,6 @@
  *	This is thread-safe on BSD/OS using flockfile/funlockfile.
  */
 
-#ifndef HAVE_FSEEKO
 int
 fseeko(FILE *stream, off_t offset, int whence)
 {
@@ -68,17 +65,3 @@
 	funlockfile(stream);
 	return -1;
 }
-#endif
-
-
-#ifndef HAVE_FTELLO
-off_t
-ftello(FILE *stream)
-{
-	fpos_t floc;
-
-	if (fgetpos(stream, &floc) != 0)
-		return -1;
-	return floc;
-}
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/osdep/ftello.c	Wed Jan 10 19:35:41 2007 +0000
@@ -0,0 +1,19 @@
+/*
+ * ftello.c
+ *	  64-bit version of ftello() for systems which do not have it
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+
+off_t
+ftello(FILE *stream)
+{
+	fpos_t floc;
+
+	if (fgetpos(stream, &floc) != 0)
+		return -1;
+	return floc;
+}