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

ruby-changes:28610

From: kosaki <ko1@a...>
Date: Sun, 12 May 2013 17:41:37 +0900 (JST)
Subject: [ruby-changes:28610] kosaki:r40662 (trunk): * configure.in: removes AC_CHECK_FUNC(ftruncate64).

kosaki	2013-05-12 17:41:24 +0900 (Sun, 12 May 2013)

  New Revision: 40662

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

  Log:
    * configure.in: removes AC_CHECK_FUNC(ftruncate64).
    * configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating
      NUM2OFFT.
    * file.c (rb_file_truncate): use correct type. chsize() take
      a long.
    * include/ruby/ruby.h (NUM2OFFT): use a definition created by
      a configure script by default.

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

Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 40661)
+++ include/ruby/ruby.h	(revision 40662)
@@ -641,10 +641,12 @@ rb_num2ll_inline(VALUE x) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L641
 # define NUM2ULL(x) rb_num2ull(x)
 #endif
 
-#if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
-# define NUM2OFFT(x) ((off_t)NUM2LL(x))
-#else
-# define NUM2OFFT(x) NUM2LONG(x)
+#if !defined(NUM2OFFT)
+# if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
+#  define NUM2OFFT(x) ((off_t)NUM2LL(x))
+# else
+#  define NUM2OFFT(x) NUM2LONG(x)
+# endif
 #endif
 
 #if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG
Index: configure.in
===================================================================
--- configure.in	(revision 40661)
+++ configure.in	(revision 40662)
@@ -1246,6 +1246,7 @@ RUBY_REPLACE_TYPE(rlim_t, [int long "lon https://github.com/ruby/ruby/blob/trunk/configure.in#L1246
 @%:@endif
 @%:@include <sys/resource.h>
 ])
+RUBY_REPLACE_TYPE(off_t, [], OFFT)
 
 AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
   [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
@@ -1745,7 +1746,7 @@ AC_CHECK_FUNCS(fmod) https://github.com/ruby/ruby/blob/trunk/configure.in#L1746
 AC_CHECK_FUNCS(fork)
 AC_CHECK_FUNCS(fsync)
 AC_CHECK_FUNCS(ftruncate)
-AC_CHECK_FUNCS(ftruncate64)
+AC_CHECK_FUNCS(ftruncate64)		# used for Win32 platform
 AC_CHECK_FUNCS(getcwd)
 AC_CHECK_FUNCS(getgrnam_r)
 AC_CHECK_FUNCS(getgroups)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40661)
+++ ChangeLog	(revision 40662)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May 12 16:31:27 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating
+	  NUM2OFFT.
+	* file.c (rb_file_truncate): use correct type. chsize() take
+	  a long.
+	* include/ruby/ruby.h (NUM2OFFT): use a definition created by
+	  a configure script by default.
+
 Sun May 12 16:03:41 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* configure.in: removes AC_CHECK_FUNC(fseeko, fseeko64, ftello,
Index: file.c
===================================================================
--- file.c	(revision 40661)
+++ file.c	(revision 40662)
@@ -4147,10 +4147,16 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/file.c#L4147
 rb_file_truncate(VALUE obj, VALUE len)
 {
     rb_io_t *fptr;
+#if defined(HAVE_FTRUNCATE)
+#define NUM2POS(n) NUM2OFFT(n)
     off_t pos;
+#else
+#define NUM2POS(n) NUM2LONG(n)
+    long pos;
+#endif
 
     rb_secure(2);
-    pos = NUM2OFFT(len);
+    pos = NUM2POS(len);
     GetOpenFile(obj, fptr);
     if (!(fptr->mode & FMODE_WRITABLE)) {
 	rb_raise(rb_eIOError, "not opened for writing");
@@ -4164,6 +4170,7 @@ rb_file_truncate(VALUE obj, VALUE len) https://github.com/ruby/ruby/blob/trunk/file.c#L4170
 	rb_sys_fail_path(fptr->pathv);
 #endif
     return INT2FIX(0);
+#undef NUM2POS
 }
 #else
 #define rb_file_truncate rb_f_notimplement

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

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