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

ruby-changes:33604

From: nobu <ko1@a...>
Date: Wed, 23 Apr 2014 13:31:16 +0900 (JST)
Subject: [ruby-changes:33604] nobu:r45685 (trunk): file.c: unpack in binary

nobu	2014-04-23 13:31:09 +0900 (Wed, 23 Apr 2014)

  New Revision: 45685

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

  Log:
    file.c: unpack in binary
    
    * file.c (statfs_fsid): convert with rb_integer_unpack.
    
    * configure.in: fsid_t is no longer used.

  Modified files:
    trunk/configure.in
    trunk/file.c
    trunk/win32/Makefile.sub
Index: configure.in
===================================================================
--- configure.in	(revision 45684)
+++ configure.in	(revision 45685)
@@ -1061,7 +1061,6 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.in#L1061
 		ac_cv_func_malloc_usable_size=no
 		ac_cv_type_struct_statfs=yes
 		ac_cv_member_struct_statfs_f_fstypename=yes
-		ac_cv_type_fsid_t=yes
 		{ test "$target_cpu" = x64 && ac_cv_func___builtin_setjmp=no; }
 		AC_CHECK_TYPE([NET_LUID], [], [],
 			      [@%:@include <windows.h>
@@ -1738,15 +1737,6 @@ AC_CHECK_MEMBERS([struct statfs.f_fstype https://github.com/ruby/ruby/blob/trunk/configure.in#L1737
 @%:@ include <sys/param.h>
 @%:@endif
 @%:@ifdef HAVE_SYS_MOUNT_H
-@%:@ include <sys/mount.h>
-@%:@endif
-@%:@ifdef HAVE_SYS_VFS_H
-@%:@ include <sys/vfs.h>
-@%:@endif])
-AC_CHECK_TYPES([fsid_t], [], [], [@%:@ifdef HAVE_SYS_PARAM_H
-@%:@ include <sys/param.h>
-@%:@endif
-@%:@ifdef HAVE_SYS_MOUNT_H
 @%:@ include <sys/mount.h>
 @%:@endif
 @%:@ifdef HAVE_SYS_VFS_H
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 45684)
+++ win32/Makefile.sub	(revision 45685)
@@ -701,7 +701,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/ https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L701
 #define HAVE_RB_FD_INIT 1
 #define HAVE_STRUCT_STATFS 1
 #define HAVE_STRUCT_STATFS_F_FSTYPENAME 1
-#define HAVE_FSID_T 1
 #define RUBY_SETJMP(env) _setjmp(env)
 #define RUBY_LONGJMP(env,val) longjmp(env,val)
 #define RUBY_JMP_BUF jmp_buf
Index: file.c
===================================================================
--- file.c	(revision 45684)
+++ file.c	(revision 45685)
@@ -5540,16 +5540,9 @@ statfs_ffree(VALUE self) https://github.com/ruby/ruby/blob/trunk/file.c#L5540
 static VALUE
 statfs_fsid(VALUE self)
 {
-#ifdef HAVE_FSID_T
-    union {
-	uint64_t v;
-	fsid_t f;
-    } n = {0};
-    n.f = get_statfs(self)->f_fsid;
-    return LL2NUM(n.v);
-#else
-    return LONG2NUM(get_statfs(self)->f_fsid);
-#endif
+    return rb_integer_unpack(&get_statfs(self)->f_fsid,
+			     1, sizeof(get_statfs(self)->f_fsid),
+			     0, INTEGER_PACK_2COMP|INTEGER_PACK_NATIVE_BYTE_ORDER);
 }
 
 #ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME

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

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