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

ruby-changes:11291

From: nobu <ko1@a...>
Date: Thu, 12 Mar 2009 05:27:18 +0900 (JST)
Subject: [ruby-changes:11291] Ruby:r22903 (trunk): * configure.in (RUBY_CHECK_HUGE): checks whether a value range is

nobu	2009-03-12 05:27:07 +0900 (Thu, 12 Mar 2009)

  New Revision: 22903

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

  Log:
    * configure.in (RUBY_CHECK_HUGE): checks whether a value range is
      larger than long.
    * file.c (rb_stat_blocks): struct stat.st_blocks may be larger
      than long.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/file.c

Index: configure.in
===================================================================
--- configure.in	(revision 22902)
+++ configure.in	(revision 22903)
@@ -894,12 +894,32 @@
 ])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
+AC_DEFUN([RUBY_CHECK_HUGE],
+    [AC_CACHE_CHECK([whether $1 is huge], AS_TR_SH(rb_cv_huge_$1),
+[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY(
+[AC_INCLUDES_DEFAULT([$4])
+static m4_bpatsubst([$1], [\..*]) rbcv_var;],
+[dnl
+sizeof(rbcv_var[]m4_bmatch([$1], [\.], .m4_bpatsubst([$1], [^[^.]*\.])))>sizeof(long)]
+)],
+[AS_TR_SH(rb_cv_huge_$1)=yes],
+[AS_TR_SH(rb_cv_huge_$1)=no])])
+if test "${AS_TR_SH(rb_cv_huge_$1)}" = yes; then
+    m4_ifval([$2], [$2], [AC_DEFINE(AS_TR_CPP(HUGE_$1))])
+m4_ifval([$3], [else
+$3
+])
+fi])
+
 AC_TYPE_SIZE_T
 AC_CHECK_SIZEOF(size_t, 0)
 AC_CHECK_SIZEOF(ptrdiff_t, $ac_cv_sizeof_size_t)
 AC_STRUCT_ST_BLKSIZE
 AC_STRUCT_ST_BLOCKS
 AC_STRUCT_ST_RDEV
+if test "$ac_cv_member_struct_stat_st_blocks" = yes; then
+    RUBY_CHECK_HUGE(struct stat.st_blocks)
+fi
 AC_CHECK_MEMBERS([struct stat.st_atim])
 AC_CHECK_MEMBERS([struct stat.st_atimespec])
 AC_CHECK_MEMBERS([struct stat.st_atimensec])
@@ -1314,17 +1334,8 @@
   fi
 fi
 
-AC_CACHE_CHECK([whether st_ino is huge], rb_cv_huge_st_ino,
-[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([
-#include <sys/stat.h>
-struct stat test_stat;
-], [sizeof(test_stat.st_ino)>sizeof(long)])],
-rb_cv_huge_st_ino=yes,
-rb_cv_huge_st_ino=no)
-])
-if test $rb_cv_huge_st_ino = yes; then
-  AC_DEFINE(HUGE_ST_INO)
-fi
+RUBY_CHECK_HUGE([struct stat.st_ino],
+  [AC_DEFINE(HUGE_ST_INO)], [], [@%:@include <sys/stat.h>])
 
 if test "$ac_cv_func_sysconf" = yes; then
   AC_DEFUN([RUBY_CHECK_SYSCONF], [dnl
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22902)
+++ ChangeLog	(revision 22903)
@@ -1,5 +1,11 @@
-Thu Mar 12 05:22:50 2009  Nobuyoshi Nakada  <nobu@r...>
+Thu Mar 12 05:27:06 2009  Nobuyoshi Nakada  <nobu@r...>
 
+	* configure.in (RUBY_CHECK_HUGE): checks whether a value range is
+	  larger than long.
+
+	* file.c (rb_stat_blocks): struct stat.st_blocks may be larger
+	  than long.
+
 	* io.c (copy_stream_fallback_body): off_t may be larger than long.
 
 	* iseq.c (rb_iseq_disasm): RSTRING_LEN() returns long.
Index: file.c
===================================================================
--- file.c	(revision 22902)
+++ file.c	(revision 22903)
@@ -502,8 +502,12 @@
 static VALUE
 rb_stat_blocks(VALUE self)
 {
-#ifdef HAVE_ST_BLOCKS
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+# ifdef HUGE_STRUCT_STAT_ST_BLOCKS
+    return ULL2NUM(get_stat(self)->st_blocks);
+# else
     return ULONG2NUM(get_stat(self)->st_blocks);
+# endif
 #else
     return Qnil;
 #endif

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

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