[前][次][番号順一覧][スレッド一覧]

ruby-changes:19224

From: luislavena <ko1@a...>
Date: Tue, 12 Apr 2011 01:43:20 +0900 (JST)
Subject: [ruby-changes:19224] Ruby:r31262 (trunk): Evaluate truncate, ftruncate and ftello existence

luislavena	2011-04-12 01:38:10 +0900 (Tue, 12 Apr 2011)

  New Revision: 31262

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31262

  Log:
    Evaluate truncate, ftruncate and ftello existence
    
    This corrects mingw-w64 compilation.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/include/ruby/win32.h
    trunk/win32/win32.c

Index: include/ruby/win32.h
===================================================================
--- include/ruby/win32.h	(revision 31261)
+++ include/ruby/win32.h	(revision 31262)
@@ -381,12 +381,24 @@
 //
 
 #define SUFFIX
+
+#if !defined HAVE_FTRUNCATE
 #define ftruncate rb_w32_ftruncate
-extern int       truncate(const char *path, off_t length);
-extern int       ftruncate(int fd, off_t length);
+extern int       rb_w32_ftruncate(int fd, off_t length);
+#endif
+
+#if !defined HAVE_TRUNCATE
+#define truncate rb_w32_truncate
+extern int       rb_w32_truncate(const char *path, off_t length);
+#endif
+
 extern int       fseeko(FILE *stream, off_t offset, int whence);
-extern off_t     ftello(FILE *stream);
 
+#if !defined HAVE_FTELLO
+#define ftello rb_w32_ftello
+extern off_t     rb_w32_ftello(FILE *stream);
+#endif
+
 //
 // stubs
 //
Index: configure.in
===================================================================
--- configure.in	(revision 31261)
+++ configure.in	(revision 31262)
@@ -1048,9 +1048,7 @@
 		ac_cv_func_isnan=yes
 		ac_cv_func_finite=yes
 		ac_cv_func_link=yes
-		ac_cv_func_truncate=yes
 		ac_cv_func_fseeko=yes
-		ac_cv_func_ftello=yes
 		ac_cv_lib_crypt_crypt=no
 		ac_cv_func_getpgrp_void=no
 		ac_cv_func_memcmp_working=yes
@@ -1302,7 +1300,7 @@
   AC_LIBOBJ([signbit])
 fi
 AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot getcwd eaccess\
-	      truncate ftruncate chsize times utimes utimensat fcntl lockf lstat\
+	      truncate ftruncate ftello chsize times utimes utimensat fcntl lockf lstat\
 	      link symlink readlink readdir_r fsync fdatasync fchown posix_fadvise\
 	      setitimer setruid seteuid setreuid setresuid setproctitle socketpair\
 	      setrgid setegid setregid setresgid issetugid pause lchown lchmod\
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31261)
+++ ChangeLog	(revision 31262)
@@ -1,3 +1,11 @@
+Tue Apr 12 01:33:00 2011  Luis Lavena  <luislavena@g...>
+
+	* configure.in: properly evaluate existence of truncate, ftruncate
+	  and ftello for MinGW. [ruby-core:35678]
+	* win32/win32.c: rename truncate, ftruncate and ftello to avoid 
+	  redefinitions.
+	* win32/win32.h: ditto.
+
 Mon Apr 11 21:51:52 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* io.c: revert r31230.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 31261)
+++ win32/win32.c	(revision 31262)
@@ -4318,7 +4318,7 @@
 }
 
 int
-truncate(const char *path, off_t length)
+rb_w32_truncate(const char *path, off_t length)
 {
     HANDLE h;
     int ret;
@@ -4344,7 +4344,7 @@
 }
 
 int
-ftruncate(int fd, off_t length)
+rb_w32_ftruncate(int fd, off_t length)
 {
     HANDLE h;
 
@@ -4417,7 +4417,7 @@
 }
 
 off_t
-ftello(FILE *stream)
+rb_w32_ftello(FILE *stream)
 {
     off_t pos;
     if (fgetpos(stream, (fpos_t *)&pos)) return (off_t)-1;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]