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

ruby-changes:11309

From: nobu <ko1@a...>
Date: Fri, 13 Mar 2009 10:42:32 +0900 (JST)
Subject: [ruby-changes:11309] Ruby:r22922 (trunk): * configure.in (AC_HEADER_DIRENT): added.

nobu	2009-03-13 10:42:21 +0900 (Fri, 13 Mar 2009)

  New Revision: 22922

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

  Log:
    * configure.in (AC_HEADER_DIRENT): added.
    * include/ruby/ruby.h (NUM2INT, rb_special_const_p): returns true
      and false instead of Qtrue and Qfalse for platforms where VALUE
      is bigger than int.
    
    * gc.c (gc_stress_set), ext/openssl/ossl_asn1.c (decode_bool): got
      rid of variables named `bool'.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/ext/openssl/ossl_asn1.c
    trunk/gc.c
    trunk/include/ruby/ruby.h

Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 22921)
+++ include/ruby/ruby.h	(revision 22922)
@@ -103,6 +103,13 @@
 # error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
 #endif
 
+typedef char ruby_check_sizeof_int[SIZEOF_INT == sizeof(int) ? 1 : -1];
+typedef char ruby_check_sizeof_long[SIZEOF_LONG == sizeof(long) ? 1 : -1];
+#ifdef SIZEOF_LONG_LONG
+typedef char ruby_check_sizeof_long_long[SIZEOF_LONG_LONG == sizeof(LONG_LONG) ? 1 : -1];
+#endif
+typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
+
 #if defined PRIdPTR && !defined PRI_VALUE_PREFIX
 #define PRIdVALUE PRIdPTR
 #define PRIiVALUE PRIiPTR
@@ -302,6 +309,28 @@
     RUBY_SPECIAL_SHIFT  = 8
 };
 
+#if defined HAVE_STDBOOL_H
+# include <stdbool.h>
+#elif defined __cplusplus
+typedef bool _Bool;
+#else
+# ifndef HAVE__BOOL
+#   define _Bool signed char
+# endif
+# ifndef bool
+#   define bool _Bool
+# endif
+# ifndef false
+#   define false 0
+# endif
+# ifndef true
+#   define true 1
+# endif
+# ifndef __bool_true_false_are_defined
+#   define __bool_true_false_are_defined 1
+# endif
+#endif
+
 #define Qfalse ((VALUE)RUBY_Qfalse)
 #define Qtrue  ((VALUE)RUBY_Qtrue)
 #define Qnil   ((VALUE)RUBY_Qnil)
@@ -375,7 +404,7 @@
 #define T_ZOMBIE RUBY_T_ZOMBIE
 #define T_MASK   RUBY_T_MASK
 
-#define BUILTIN_TYPE(x) (((struct RBasic*)(x))->flags & T_MASK)
+#define BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & T_MASK)
 
 #define TYPE(x) rb_type((VALUE)(x))
 
@@ -439,7 +468,7 @@
 static inline int
 NUM2INT(VALUE x)
 {
-    return FIXNUM_P(x) ? FIX2INT(x) : rb_num2int(x);
+    return FIXNUM_P(x) ? FIX2INT(x) : (int)rb_num2int(x);
 }
 unsigned long rb_num2uint(VALUE);
 #define NUM2UINT(x) ((unsigned int)rb_num2uint(x))
@@ -1142,8 +1171,8 @@
 static inline int
 rb_special_const_p(VALUE obj)
 {
-    if (SPECIAL_CONST_P(obj)) return Qtrue;
-    return Qfalse;
+    if (SPECIAL_CONST_P(obj)) return true;
+    return false;
 }
 
 #include "ruby/missing.h"
Index: configure.in
===================================================================
--- configure.in	(revision 22921)
+++ configure.in	(revision 22922)
@@ -887,6 +887,7 @@
 dnl Checks for header files.
 AC_HEADER_DIRENT
 dnl AC_HEADER_STDC has been checked in AC_USE_SYSTEM_EXTENSIONS
+AC_HEADER_STDBOOL
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(limits.h sys/file.h sys/ioctl.h sys/syscall.h\
 		 fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22921)
+++ ChangeLog	(revision 22922)
@@ -1,3 +1,14 @@
+Fri Mar 13 10:42:19 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (AC_HEADER_DIRENT): added.
+
+	* include/ruby/ruby.h (NUM2INT, rb_special_const_p): returns true
+	  and false instead of Qtrue and Qfalse for platforms where VALUE
+	  is bigger than int.
+
+	* gc.c (gc_stress_set), ext/openssl/ossl_asn1.c (decode_bool): go
+	  rid of variables named `bool'.
+
 Fri Mar 13 10:16:36 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (struct stat.st_size): may be huge.
Index: gc.c
===================================================================
--- gc.c	(revision 22921)
+++ gc.c	(revision 22922)
@@ -480,12 +480,12 @@
  */
 
 static VALUE
-gc_stress_set(VALUE self, VALUE bool)
+gc_stress_set(VALUE self, VALUE flag)
 {
     rb_objspace_t *objspace = &rb_objspace;
     rb_secure(2);
-    ruby_gc_stress = RTEST(bool);
-    return bool;
+    ruby_gc_stress = RTEST(flag);
+    return flag;
 }
 
 /*
@@ -1636,7 +1636,7 @@
 	break;
 
       default:
-	rb_bug("rb_gc_mark(): unknown data type 0x%lx(%p) %s",
+	rb_bug("rb_gc_mark(): unknown data type 0x%x(%p) %s",
 	       BUILTIN_TYPE(obj), (void *)obj,
 	       is_pointer_to_heap(objspace, obj) ? "corrupted object" : "non object");
     }
@@ -1934,7 +1934,7 @@
 	break;
 
       default:
-	rb_bug("gc_sweep(): unknown data type 0x%lx(%p)",
+	rb_bug("gc_sweep(): unknown data type 0x%x(%p)",
 	       BUILTIN_TYPE(obj), (void*)obj);
     }
 
Index: ext/openssl/ossl_asn1.c
===================================================================
--- ext/openssl/ossl_asn1.c	(revision 22921)
+++ ext/openssl/ossl_asn1.c	(revision 22922)
@@ -306,14 +306,14 @@
 static VALUE
 decode_bool(unsigned char* der, int length)
 {
-    int bool;
+    int val;
     const unsigned char *p;
 
     p = der;
-    if((bool = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0)
+    if((val = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0)
 	ossl_raise(eASN1Error, NULL);
 
-    return bool ? Qtrue : Qfalse;
+    return val ? Qtrue : Qfalse;
 }
 
 static VALUE

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

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