mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
11e89eb719
commit
e9b98f413e
5 changed files with 53 additions and 12 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Fri Mar 13 10:42:19 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* configure.in (struct stat.st_size): may be huge.
|
||||
|
|
|
@ -887,6 +887,7 @@ fi
|
|||
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\
|
||||
|
|
|
@ -306,14 +306,14 @@ obj_to_asn1derstr(VALUE obj)
|
|||
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
|
||||
|
|
10
gc.c
10
gc.c
|
@ -480,12 +480,12 @@ gc_stress_get(VALUE self)
|
|||
*/
|
||||
|
||||
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 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr, int lev)
|
|||
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 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,13 @@ typedef unsigned LONG_LONG ID;
|
|||
# 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 @@ enum ruby_special_consts {
|
|||
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 @@ enum ruby_value_type {
|
|||
#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 @@ long rb_fix2int(VALUE);
|
|||
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 @@ rb_type(VALUE obj)
|
|||
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"
|
||||
|
|
Loading…
Reference in a new issue