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

ruby-changes:12493

From: nobu <ko1@a...>
Date: Sat, 18 Jul 2009 17:05:56 +0900 (JST)
Subject: [ruby-changes:12493] Ruby:r24195 (trunk): * suppressed shorten-64-to-32 warnings.

nobu	2009-07-18 17:05:32 +0900 (Sat, 18 Jul 2009)

  New Revision: 24195

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

  Log:
    * suppressed shorten-64-to-32 warnings.

  Modified files:
    trunk/bignum.c
    trunk/class.c
    trunk/dir.c
    trunk/encoding.c
    trunk/enum.c
    trunk/enumerator.c
    trunk/eval.c
    trunk/file.c
    trunk/gc.c
    trunk/hash.c
    trunk/io.c
    trunk/load.c
    trunk/marshal.c
    trunk/numeric.c
    trunk/object.c
    trunk/proc.c

Index: encoding.c
===================================================================
--- encoding.c	(revision 24194)
+++ encoding.c	(revision 24195)
@@ -539,16 +539,16 @@
 static inline int
 enc_capable(VALUE obj)
 {
-    if (SPECIAL_CONST_P(obj)) return Qfalse;
+    if (SPECIAL_CONST_P(obj)) return FALSE;
     switch (BUILTIN_TYPE(obj)) {
       case T_STRING:
       case T_REGEXP:
       case T_FILE:
-	return Qtrue;
+	return TRUE;
       case T_DATA:
-	if (RDATA(obj)->dmark == enc_mark) return Qtrue;
+	if (RDATA(obj)->dmark == enc_mark) return TRUE;
       default:
-	return Qfalse;
+	return FALSE;
     }
 }
 
@@ -744,7 +744,7 @@
         return MBCLEN_CHARFOUND_LEN(n);
     else {
         int min = rb_enc_mbminlen(enc);
-        return min <= e-p ? min : e-p;
+        return min <= e-p ? min : (int)(e-p);
     }
 }
 
@@ -756,7 +756,7 @@
         return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(1);
     n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
     if (e-p < n)
-        return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(n-(e-p));
+        return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(n-(int)(e-p));
     return n;
 }
 
@@ -1071,10 +1071,11 @@
 static int
 enc_set_default_encoding(struct default_encoding *def, VALUE encoding, const char *name)
 {
-    int overridden = Qfalse;
+    int overridden = FALSE;
+
     if (def->index != -2)
 	/* Already set */
-	overridden = Qtrue;
+	overridden = TRUE;
 
     if (NIL_P(encoding)) {
 	def->index = -1;
Index: enumerator.c
===================================================================
--- enumerator.c	(revision 24194)
+++ enumerator.c	(revision 24195)
@@ -389,7 +389,7 @@
     if (!rb_block_given_p()) return obj;
     e = enumerator_ptr(obj);
     if (e->args) {
-	argc = RARRAY_LEN(e->args);
+	argc = RARRAY_LENINT(e->args);
 	argv = RARRAY_PTR(e->args);
     }
     return rb_block_call(e->obj, e->meth, argc, argv,
@@ -430,7 +430,7 @@
     memo = NIL_P(memo) ? 0 : (VALUE)NUM2LONG(memo);
     e = enumerator_ptr(obj);
     if (e->args) {
-	argc = RARRAY_LEN(e->args);
+	argc = RARRAY_LENINT(e->args);
 	argv = RARRAY_PTR(e->args);
     }
     else {
@@ -486,7 +486,7 @@
     RETURN_ENUMERATOR(obj, 1, &memo);
     e = enumerator_ptr(obj);
     if (e->args) {
-	argc = RARRAY_LEN(e->args);
+	argc = RARRAY_LENINT(e->args);
 	argv = RARRAY_PTR(e->args);
     }
     rb_block_call(e->obj, e->meth, argc, argv,
@@ -616,8 +616,8 @@
 	    rb_str_concat(str, rb_inspect(arg));
 	    rb_str_buf_cat2(str, argc > 0 ? ", " : ")");
 
-	    if (OBJ_TAINTED(arg)) tainted = Qtrue;
-	    if (OBJ_UNTRUSTED(arg)) untrusted = Qtrue;
+	    if (OBJ_TAINTED(arg)) tainted = TRUE;
+	    if (OBJ_UNTRUSTED(arg)) untrusted = TRUE;
 	}
     }
 
Index: enum.c
===================================================================
--- enum.c	(revision 24194)
+++ enum.c	(revision 24195)
@@ -1568,13 +1568,13 @@
     NODE *memo;
     VALUE result = Qnil;
     VALUE args = rb_ary_new4(argc, argv);
-    int allary = Qtrue;
+    int allary = TRUE;
 
     argv = RARRAY_PTR(args);
     for (i=0; i<argc; i++) {
 	VALUE ary = rb_check_array_type(argv[i]);
 	if (NIL_P(ary)) {
-	    allary = Qfalse;
+	    allary = FALSE;
 	    break;
 	}
 	argv[i] = ary;
Index: object.c
===================================================================
--- object.c	(revision 24194)
+++ object.c	(revision 24195)
@@ -99,7 +99,7 @@
 rb_obj_hash(VALUE obj)
 {
     VALUE oid = rb_obj_id(obj);
-    unsigned h = rb_hash_end(rb_hash_start(NUM2LONG(oid)));
+    unsigned long h = rb_hash_end(rb_hash_start(NUM2LONG(oid)));
     return LONG2NUM(h);
 }
 
@@ -1549,7 +1549,7 @@
     int i;
 
     for (i=0; i<argc; i++) {
-	rb_attr(klass, rb_to_id(argv[i]), Qtrue, Qfalse, Qtrue);
+	rb_attr(klass, rb_to_id(argv[i]), TRUE, FALSE, TRUE);
     }
     return Qnil;
 }
@@ -1559,7 +1559,7 @@
 {
     if (argc == 2 && (argv[1] == Qtrue || argv[1] == Qfalse)) {
 	rb_warning("optional boolean argument is obsoleted");
-	rb_attr(klass, rb_to_id(argv[0]), 1, RTEST(argv[1]), Qtrue);
+	rb_attr(klass, rb_to_id(argv[0]), 1, RTEST(argv[1]), TRUE);
 	return Qnil;
     }
     return rb_mod_attr_reader(argc, argv, klass);
@@ -1579,7 +1579,7 @@
     int i;
 
     for (i=0; i<argc; i++) {
-	rb_attr(klass, rb_to_id(argv[i]), Qfalse, Qtrue, Qtrue);
+	rb_attr(klass, rb_to_id(argv[i]), FALSE, TRUE, TRUE);
     }
     return Qnil;
 }
@@ -1605,7 +1605,7 @@
     int i;
 
     for (i=0; i<argc; i++) {
-	rb_attr(klass, rb_to_id(argv[i]), Qtrue, Qtrue, Qtrue);
+	rb_attr(klass, rb_to_id(argv[i]), TRUE, TRUE, TRUE);
     }
     return Qnil;
 }
@@ -2024,7 +2024,7 @@
     VALUE v;
 
     if (TYPE(val) == type) return val;
-    v = convert_type(val, tname, method, Qtrue);
+    v = convert_type(val, tname, method, TRUE);
     if (TYPE(v) != type) {
 	const char *cname = rb_obj_classname(val);
 	rb_raise(rb_eTypeError, "can't convert %s to %s (%s#%s gives %s)",
@@ -2040,7 +2040,7 @@
 
     /* always convert T_DATA */
     if (TYPE(val) == type && type != T_DATA) return val;
-    v = convert_type(val, tname, method, Qfalse);
+    v = convert_type(val, tname, method, FALSE);
     if (NIL_P(v)) return Qnil;
     if (TYPE(v) != type) {
 	const char *cname = rb_obj_classname(val);
@@ -2058,7 +2058,7 @@
 
     if (FIXNUM_P(val)) return val;
     if (TYPE(val) == T_BIGNUM) return val;
-    v = convert_type(val, "Integer", method, Qtrue);
+    v = convert_type(val, "Integer", method, TRUE);
     if (!rb_obj_is_kind_of(v, rb_cInteger)) {
 	const char *cname = rb_obj_classname(val);
 	rb_raise(rb_eTypeError, "can't convert %s to Integer (%s#%s gives %s)",
@@ -2074,7 +2074,7 @@
 
     if (FIXNUM_P(val)) return val;
     if (TYPE(val) == T_BIGNUM) return val;
-    v = convert_type(val, "Integer", method, Qfalse);
+    v = convert_type(val, "Integer", method, FALSE);
     if (!rb_obj_is_kind_of(v, rb_cInteger)) {
 	return Qnil;
     }
@@ -2105,7 +2105,7 @@
 	return val;
 
       case T_STRING:
-	return rb_str_to_inum(val, 0, Qtrue);
+	return rb_str_to_inum(val, 0, TRUE);
 
       case T_NIL:
 	rb_raise(rb_eTypeError, "can't convert nil into Integer");
@@ -2114,7 +2114,7 @@
       default:
 	break;
     }
-    tmp = convert_type(val, "Integer", "to_int", Qfalse);
+    tmp = convert_type(val, "Integer", "to_int", FALSE);
     if (NIL_P(tmp)) {
 	return rb_to_integer(val, "to_i");
     }
@@ -2152,7 +2152,10 @@
     double d;
     const char *ellipsis = "";
     int w;
-#define OutOfRange() (((w = end - p) > 20) ? (w = 20, ellipsis = "...") : (ellipsis = ""))
+    enum {max_width = 20};
+#define OutOfRange() ((end - p > max_width) ? \
+		      (w = max_width, ellipsis = "...") : \
+		      (w = (int)(end - p), ellipsis = ""))
 
     if (!p) return 0.0;
     q = p;
@@ -2225,6 +2228,9 @@
     s = RSTRING_PTR(str);
     len = RSTRING_LEN(str);
     if (s) {
+	if (badcheck && memchr(s, '\0', len)) {
+	    rb_raise(rb_eArgError, "string for Float contains null byte");
+	}
 	if (s[len]) {		/* no sentinel somehow */
 	    char *p = ALLOCA_N(char, len+1);
 
@@ -2232,9 +2238,6 @@
 	    p[len] = '\0';
 	    s = p;
 	}
-	if (badcheck && len != strlen(s)) {
-	    rb_raise(rb_eArgError, "string for Float contains null byte");
-	}
     }
     return rb_cstr_to_dbl(s, badcheck);
 }
@@ -2253,7 +2256,7 @@
 	return DBL2NUM(rb_big2dbl(val));
 
       case T_STRING:
-	return DBL2NUM(rb_str_to_dbl(val, Qtrue));
+	return DBL2NUM(rb_str_to_dbl(val, TRUE));
 
       case T_NIL:
 	rb_raise(rb_eTypeError, "can't convert nil into Float");
Index: io.c
===================================================================
--- io.c	(revision 24194)
+++ io.c	(revision 24195)
@@ -628,7 +628,7 @@
       case ERESTART:
 #endif
 	rb_thread_wait_fd(f);
-	return Qtrue;
+	return TRUE;
 
       case EAGAIN:
 #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
@@ -642,10 +642,10 @@
 #else
 	rb_thread_select(f + 1, rb_fd_ptr(&rfds), NULL, NULL, NULL);
 #endif
-	return Qtrue;
+	return TRUE;
 
       default:
-	return Qfalse;
+	return FALSE;
     }
 }
 
@@ -673,7 +673,7 @@
       case ERESTART:
 #endif
 	rb_thread_fd_writable(f);
-	return Qtrue;
+	return TRUE;
 
       case EAGAIN:
 #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
@@ -687,10 +687,10 @@
 #else
 	rb_thread_select(f + 1, NULL, rb_fd_ptr(&wfds), NULL, NULL);
 #endif
-	return Qtrue;
+	return TRUE;
 
       default:
-	return Qfalse;
+	return FALSE;
     }
 }
 
@@ -2217,7 +2217,7 @@
 	    const char *p = READ_DATA_PENDING_PTR(fptr);
 	    int i;
 	    if (cnt > sizeof buf) cnt = sizeof buf;
-	    if (*p != term) return Qtrue;
+	    if (*p != term) return TRUE;
 	    i = (int)cnt;
 	    while (--i && *++p == term);
 	    if (!read_buffered_data(buf, cnt - i, fptr)) /* must not fail */
@@ -2226,7 +2226,7 @@
 	rb_thread_wait_fd(fptr->fd);
 	rb_io_check_closed(fptr);
     } while (io_fillbuf(fptr) == 0);
-    return Qfalse;
+    return FALSE;
 }
 
 static VALUE
@@ -3434,7 +3434,7 @@
     fptr->pathv = Qnil;
     fptr->write_lock = 0;
     if (0 <= fptr->fd)
-	rb_io_fptr_cleanup(fptr, Qtrue);
+	rb_io_fptr_cleanup(fptr, TRUE);
     if (fptr->rbuf) {
         free(fptr->rbuf);
         fptr->rbuf = 0;
@@ -3474,7 +3474,7 @@
     if (io != write_io) {
         write_fptr = RFILE(write_io)->fptr;
         if (write_fptr && 0 <= write_fptr->fd) {
-            rb_io_fptr_cleanup(write_fptr, Qtrue);
+            rb_io_fptr_cleanup(write_fptr, TRUE);
         }
     }
 
@@ -3483,7 +3483,7 @@
     if (fptr->fd < 0) return Qnil;
 
     fd = fptr->fd;
-    rb_io_fptr_cleanup(fptr, Qfalse);
+    rb_io_fptr_cleanup(fptr, FALSE);
     rb_thread_fd_close(fd);
 
     if (fptr->pid) {
@@ -3613,7 +3613,7 @@
     write_io = GetWriteIO(io);
     if (io != write_io) {
 	rb_io_t *wfptr;
-        rb_io_fptr_cleanup(fptr, Qfalse);
+        rb_io_fptr_cleanup(fptr, FALSE);
 	GetOpenFile(write_io, wfptr);
         RFILE(io)->fptr = wfptr;
         RFILE(write_io)->fptr = NULL;
@@ -5114,7 +5114,7 @@
 {
     VALUE prog;
     struct rb_exec_arg earg;
-    prog = rb_exec_arg_init(argc, argv, Qfalse, &earg);
+    prog = rb_exec_arg_init(argc, argv, FALSE, &earg);
     return pipe_open(&earg, prog, modestr, fmode, convconfig);
 }
 
@@ -5134,7 +5134,7 @@
         return pipe_open(0, 0, modestr, fmode, convconfig);
     }
 
-    rb_exec_arg_init(argc, argv, Qtrue, &earg);
+    rb_exec_arg_init(argc, argv, TRUE, &earg);
     return pipe_open(&earg, prog, modestr, fmode, convconfig);
 }
 
@@ -5548,18 +5548,18 @@
 rb_f_open(int argc, VALUE *argv)
 {
     ID to_open = 0;
-    int redirect = Qfalse;
+    int redirect = FALSE;
 
     if (argc >= 1) {
 	CONST_ID(to_open, "to_open");
 	if (rb_respond_to(argv[0], to_open)) {
-	    redirect = Qtrue;
+	    redirect = TRUE;
 	}
 	else {
 	    VALUE tmp = argv[0];
 	    FilePathValue(tmp);
 	    if (NIL_P(tmp)) {
-		redirect = Qtrue;
+		redirect = TRUE;
 	    }
 	    else {
                 VALUE cmd = check_pipe_command(tmp);
@@ -6683,7 +6683,7 @@
 	}
 	else {
 	    ARGF.next_p = 1;
-	    return Qfalse;
+	    return FALSE;
 	}
     }
     else if (ARGF.next_p == -1) {
@@ -6694,7 +6694,7 @@
 	    rb_stdout = orig_stdout;
 	}
     }
-    return Qtrue;
+    return TRUE;
 }
 
 static VALUE
Index: load.c
===================================================================
--- load.c	(revision 24194)
+++ load.c	(revision 24195)
@@ -225,17 +225,17 @@
     }
     if (ext && !strchr(ext, '/')) {
 	if (IS_RBEXT(ext)) {
-	    if (rb_feature_p(feature, ext, Qtrue, Qfalse, loading)) return Qtrue;
-	    return Qfalse;
+	    if (rb_feature_p(feature, ext, Qtrue, Qfalse, loading)) return TRUE;
+	    return FALSE;
 	}
 	else if (IS_SOEXT(ext) || IS_DLEXT(ext)) {
-	    if (rb_feature_p(feature, ext, Qfalse, Qfalse, loading)) return Qtrue;
-	    return Qfalse;
+	    if (rb_feature_p(feature, ext, Qfalse, Qfalse, loading)) return TRUE;
+	    return FALSE;
 	}
     }
-    if (rb_feature_p(feature, feature + strlen(feature), Qtrue, Qfalse, loading))
-	return Qtrue;
-    return Qfalse;
+    if (rb_feature_p(feature, feature + strlen(feature), TRUE, FALSE, loading))
+	return TRUE;
+    return FALSE;
 }
 
 static void
@@ -259,7 +259,7 @@
     rb_thread_t *th = GET_THREAD();
     volatile VALUE wrapper = th->top_wrapper;
     volatile VALUE self = th->top_self;
-    volatile int loaded = Qfalse;
+    volatile int loaded = FALSE;
     volatile int mild_compile_error;
 #ifndef __GNUC__
     rb_thread_t *volatile th0 = th;
@@ -287,7 +287,7 @@
 
 	th->mild_compile_error++;
 	node = (NODE *)rb_load_file(RSTRING_PTR(fname));
-	loaded = Qtrue;
+	loaded = TRUE;
 	iseq = rb_iseq_new_top(node, rb_str_new2("<top (required)>"), fname, Qfalse);
 	th->mild_compile_error--;
 	rb_iseq_eval(iseq);
@@ -451,20 +451,20 @@
     ext = strrchr(ftptr = RSTRING_PTR(fname), '.');
     if (ext && !strchr(ext, '/')) {
 	if (IS_RBEXT(ext)) {
-	    if (rb_feature_p(ftptr, ext, Qtrue, Qfalse, &loading)) {
+	    if (rb_feature_p(ftptr, ext, TRUE, FALSE, &loading)) {
 		if (loading) *path = rb_str_new2(loading);
 		return 'r';
 	    }
 	    if ((tmp = rb_find_file_safe(fname, safe_level)) != 0) {
 		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
-		if (!rb_feature_p(ftptr, ext, Qtrue, Qtrue, &loading) || loading)
+		if (!rb_feature_p(ftptr, ext, TRUE, TRUE, &loading) || loading)
 		    *path = tmp;
 		return 'r';
 	    }
 	    return 0;
 	}
 	else if (IS_SOEXT(ext)) {
-	    if (rb_feature_p(ftptr, ext, Qfalse, Qfalse, &loading)) {
+	    if (rb_feature_p(ftptr, ext, FALSE, FALSE, &loading)) {
 		if (loading) *path = rb_str_new2(loading);
 		return 's';
 	    }
@@ -482,26 +482,26 @@
 	    OBJ_FREEZE(tmp);
 	    if ((tmp = rb_find_file_safe(tmp, safe_level)) != 0) {
 		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
-		if (!rb_feature_p(ftptr, ext, Qfalse, Qtrue, &loading) || loading)
+		if (!rb_feature_p(ftptr, ext, FALSE, TRUE, &loading) || loading)
 		    *path = tmp;
 		return 's';
 	    }
 #endif
 	}
 	else if (IS_DLEXT(ext)) {
-	    if (rb_feature_p(ftptr, ext, Qfalse, Qfalse, &loading)) {
+	    if (rb_feature_p(ftptr, ext, FALSE, FALSE, &loading)) {
 		if (loading) *path = rb_str_new2(loading);
 		return 's';
 	    }
 	    if ((tmp = rb_find_file_safe(fname, safe_level)) != 0) {
 		ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
-		if (!rb_feature_p(ftptr, ext, Qfalse, Qtrue, &loading) || loading)
+		if (!rb_feature_p(ftptr, ext, FALSE, TRUE, &loading) || loading)
 		    *path = tmp;
 		return 's';
 	    }
 	}
     }
-    else if ((ft = rb_feature_p(ftptr, 0, Qfalse, Qfalse, &loading)) == 'r') {
+    else if ((ft = rb_feature_p(ftptr, 0, FALSE, FALSE, &loading)) == 'r') {
 	if (loading) *path = rb_str_new2(loading);
 	return 'r';
     }
@@ -512,14 +512,14 @@
 	if (ft)
 	    break;
 	ftptr = RSTRING_PTR(tmp);
-	return rb_feature_p(ftptr, 0, Qfalse, Qtrue, 0);
+	return rb_feature_p(ftptr, 0, FALSE, TRUE, 0);
 
       default:
 	if (ft)
 	    break;
       case 1:
 	ext = strrchr(ftptr = RSTRING_PTR(tmp), '.');
-	if (rb_feature_p(ftptr, ext, !--type, Qtrue, &loading) && !loading)
+	if (rb_feature_p(ftptr, ext, !--type, TRUE, &loading) && !loading)
 	    break;
 	*path = tmp;
     }
Index: proc.c
===================================================================
--- proc.c	(revision 24194)
+++ proc.c	(revision 24195)
@@ -409,7 +409,7 @@
     if (is_lambda) {
 	rb_proc_t *proc;
 	GetProcPtr(procval, proc);
-	proc->is_lambda = Qtrue;
+	proc->is_lambda = TRUE;
     }
     return procval;
 }
@@ -434,7 +434,7 @@
 static VALUE
 rb_proc_s_new(int argc, VALUE *argv, VALUE klass)
 {
-    VALUE block = proc_new(klass, Qfalse);
+    VALUE block = proc_new(klass, FALSE);
 
     rb_obj_call_init(block, argc, argv);
     return block;
@@ -450,13 +450,13 @@
 VALUE
 rb_block_proc(void)
 {
-    return proc_new(rb_cProc, Qfalse);
+    return proc_new(rb_cProc, FALSE);
 }
 
 VALUE
 rb_block_lambda(void)
 {
-    return proc_new(rb_cProc, Qtrue);
+    return proc_new(rb_cProc, TRUE);
 }
 
 VALUE
@@ -1095,13 +1095,13 @@
 VALUE
 rb_obj_method(VALUE obj, VALUE vid)
 {
-    return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, Qfalse);
+    return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, FALSE);
 }
 
 VALUE
 rb_obj_public_method(VALUE obj, VALUE vid)
 {
-    return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, Qtrue);
+    return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, TRUE);
 }
 
 /*
@@ -1139,13 +1139,13 @@
 static VALUE
 rb_mod_instance_method(VALUE mod, VALUE vid)
 {
-    return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod, Qfalse);
+    return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod, FALSE);
 }
 
 static VALUE
 rb_mod_public_instance_method(VALUE mod, VALUE vid)
 {
-    return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod, Qtrue);
+    return mnew(mod, Qundef, rb_to_id(vid), rb_cUnboundMethod, TRUE);
 }
 
 /*
@@ -1232,8 +1232,8 @@
 	if (BUILTIN_TYPE(proc->block.iseq) != T_NODE) {
 	    proc->block.iseq->defined_method_id = id;
 	    proc->block.iseq->klass = mod;
-	    proc->is_lambda = Qtrue;
-	    proc->is_from_method = Qtrue;
+	    proc->is_lambda = TRUE;
+	    proc->is_from_method = TRUE;
 	}
 	rb_add_method(mod, id, VM_METHOD_TYPE_BMETHOD, (void *)body, noex);
     }
Index: dir.c
===================================================================
--- dir.c	(revision 24194)
+++ dir.c	(revision 24195)
@@ -701,7 +701,7 @@
 chdir_yield(struct chdir_data *args)
 {
     dir_chdir(args->new_path);
-    args->done = Qtrue;
+    args->done = TRUE;
     chdir_blocking++;
     if (chdir_thread == Qnil)
 	chdir_thread = rb_thread_current();
@@ -788,7 +788,7 @@
 
 	args.old_path = rb_tainted_str_new2(cwd); xfree(cwd);
 	args.new_path = path;
-	args.done = Qfalse;
+	args.done = FALSE;
 	return rb_ensure(chdir_yield, (VALUE)&args, chdir_restore, (VALUE)&args);
     }
     dir_chdir(path);
Index: eval.c
===================================================================
--- eval.c	(revision 24194)
+++ eval.c	(revision 24195)
@@ -15,6 +15,8 @@
 #include "iseq.h"
 #include "gc.h"
 
+#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+
 VALUE proc_invoke(VALUE, VALUE, VALUE, VALUE);
 VALUE rb_binding_new(void);
 NORETURN(void rb_raise_jump(VALUE));
@@ -157,7 +159,7 @@
     POP_TAG();
     rb_thread_stop_timer_thread();
 
-    for (nerr = 0; nerr < sizeof(errs) / sizeof(errs[0]); ++nerr) {
+    for (nerr = 0; nerr < numberof(errs); ++nerr) {
 	VALUE err = errs[nerr];
 
 	if (!RTEST(err)) continue;
@@ -534,10 +536,10 @@
 
     if ((th->cfp->lfp[0] & 0x02) == 0 &&
 	GC_GUARDED_PTR_REF(th->cfp->lfp[0])) {
-	return Qtrue;
+	return TRUE;
     }
     else {
-	return Qfalse;
+	return FALSE;
     }
 }
 
@@ -577,13 +579,13 @@
 	th->cfp = cfp; /* restore */
 
 	if (state == TAG_RAISE) {
-	    int handle = Qfalse;
+	    int handle = FALSE;
 	    VALUE eclass;
 
 	    va_init_list(args, data2);
 	    while ((eclass = va_arg(args, VALUE)) != 0) {
 		if (rb_obj_is_kind_of(th->errinfo, eclass)) {
-		    handle = Qtrue;
+		    handle = TRUE;
 		    break;
 		}
 	    }
Index: gc.c
===================================================================
--- gc.c	(revision 24194)
+++ gc.c	(revision 24195)
@@ -541,7 +541,7 @@
 {
     rb_objspace_t *objspace = &rb_objspace;
 
-    objspace->profile.run = Qtrue;
+    objspace->profile.run = TRUE;
     return Qnil;
 }
 
@@ -559,7 +559,7 @@
 {
     rb_objspace_t *objspace = &rb_objspace;
 
-    objspace->profile.run = Qfalse;
+    objspace->profile.run = FALSE;
     return Qnil;
 }
 
@@ -788,7 +788,7 @@
     rb_objspace_t *objspace = &rb_objspace;
     int old = dont_gc;
 
-    dont_gc = Qfalse;
+    dont_gc = FALSE;
     return old;
 }
 
@@ -810,7 +810,7 @@
     rb_objspace_t *objspace = &rb_objspace;
     int old = dont_gc;
 
-    dont_gc = Qtrue;
+    dont_gc = TRUE;
     return old;
 }
 
@@ -987,9 +987,9 @@
     if (heaps_inc > 0) {
         assign_heap_slot(objspace, &freelist, lifetime_normal);
 	heaps_inc--;
-	return Qtrue;
+	return TRUE;
     }
-    return Qfalse;
+    return FALSE;
 }
 
 #define LONGLIFE_ALLOCATE_HEAPS_MIN 10
@@ -1335,8 +1335,8 @@
     register struct heaps_slot *heap;
     register size_t hi, lo, mid;
 
-    if (p < lomem || p > himem) return Qfalse;
-    if ((VALUE)p % sizeof(RVALUE) != 0) return Qfalse;
+    if (p < lomem || p > himem) return FALSE;
+    if ((VALUE)p % sizeof(RVALUE) != 0) return FALSE;
 
     /* check if p looks like a pointer using bsearch*/
     lo = 0;
@@ -1346,14 +1346,14 @@
 	heap = &heaps[mid];
 	if (heap->slot <= p) {
 	    if (p < heap->slot + heap->limit)
-		return Qtrue;
+		return TRUE;
 	    lo = mid + 1;
 	}
 	else {
 	    hi = mid;
 	}
     }
-    return Qfalse;
+    return FALSE;
 }
 
 VALUE
@@ -1997,7 +1997,7 @@
     malloc_increase = 0;
     if (freed < free_min) {
         if (!heaps_inc && objspace->heap.longlife_used)
-            objspace->flags.longlife_collection = Qtrue;
+            objspace->flags.longlife_collection = TRUE;
         set_heaps_increment(objspace);
         heaps_increment(objspace);
     }
@@ -2065,7 +2065,7 @@
     }
 
     remembered_set_recycle(objspace);
-    objspace->flags.longlife_collection = Qfalse;
+    objspace->flags.longlife_collection = FALSE;
     objspace->profile.longlife_objects = objspace->profile.longlife_objects - freed;
 }
 
@@ -2305,7 +2305,7 @@
     if (GC_NOTIFY) printf("start garbage_collect()\n");
 
     if (!heaps) {
-	return Qfalse;
+	return FALSE;
     }
 
     if (dont_gc || during_gc) {
@@ -2315,7 +2315,7 @@
                 heaps_increment(objspace);
             }
 	}
-	return Qtrue;
+	return TRUE;
     }
     during_gc++;
     objspace->count++;
@@ -2379,7 +2379,7 @@
 
     GC_PROF_TIMER_STOP;
     if (GC_NOTIFY) printf("end garbage_collect()\n");
-    return Qtrue;
+    return TRUE;
 }
 
 int
@@ -2425,7 +2425,7 @@
 {
     rb_objspace_t *objspace = &rb_objspace;
     if (objspace->heap.longlife_used) {
-        objspace->flags.longlife_collection = Qtrue;
+        objspace->flags.longlife_collection = TRUE;
     }
     rb_gc();
     return Qnil;
Index: class.c
===================================================================
--- class.c	(revision 24194)
+++ class.c	(revision 24195)
@@ -491,7 +491,7 @@
     OBJ_INFECT(klass, module);
     c = klass;
     while (module) {
-	int superclass_seen = Qfalse;
+	int superclass_seen = FALSE;
 
 	if (RCLASS_M_TBL(klass) == RCLASS_M_TBL(module))
 	    rb_raise(rb_eArgError, "cyclic include detected");
@@ -507,7 +507,7 @@
 		}
 		break;
 	      case T_CLASS:
-		superclass_seen = Qtrue;
+		superclass_seen = TRUE;
 		break;
 	    }
 	}
@@ -694,7 +694,7 @@
     st_table *list;
 
     if (argc == 0) {
-	recur = Qtrue;
+	recur = TRUE;
     }
     else {
 	VALUE r;
@@ -975,7 +975,7 @@
 void
 rb_define_attr(VALUE klass, const char *name, int read, int write)
 {
-    rb_attr(klass, rb_intern(name), read, write, Qfalse);
+    rb_attr(klass, rb_intern(name), read, write, FALSE);
 }
 
 #include <stdarg.h>
Index: hash.c
===================================================================
--- hash.c	(revision 24194)
+++ hash.c	(revision 24195)
@@ -1516,7 +1516,7 @@
 static VALUE
 rb_hash_equal(VALUE hash1, VALUE hash2)
 {
-    return hash_equal(hash1, hash2, Qfalse);
+    return hash_equal(hash1, hash2, FALSE);
 }
 
 /*
@@ -1530,7 +1530,7 @@
 static VALUE
 rb_hash_eql(VALUE hash1, VALUE hash2)
 {
-    return hash_equal(hash1, hash2, Qtrue);
+    return hash_equal(hash1, hash2, TRUE);
 }
 
 static int
Index: numeric.c
===================================================================
--- numeric.c	(revision 24194)
+++ numeric.c	(revision 24195)
@@ -159,25 +159,25 @@
 	if (err) {
 	    rb_raise(rb_eTypeError, "coerce must return [x, y]");
 	}
-	return Qfalse;
+	return FALSE;
     }
 
     *x = RARRAY_PTR(ary)[0];
     *y = RARRAY_PTR(ary)[1];
-    return Qtrue;
+    return TRUE;
 }
 
 VALUE
 rb_num_coerce_bin(VALUE x, VALUE y, ID func)
 {
-    do_coerce(&x, &y, Qtrue);
+    do_coerce(&x, &y, TRUE);
     return rb_funcall(x, func, 1, y);
 }
 
 VALUE
 rb_num_coerce_cmp(VALUE x, VALUE y, ID func)
 {
-    if (do_coerce(&x, &y, Qfalse))
+    if (do_coerce(&x, &y, FALSE))
 	return rb_funcall(x, func, 1, y);
     return Qnil;
 }
@@ -187,7 +187,7 @@
 {
     VALUE c, x0 = x, y0 = y;
 
-    if (!do_coerce(&x, &y, Qfalse) ||
+    if (!do_coerce(&x, &y, FALSE) ||
 	NIL_P(c = rb_funcall(x, func, 1, y))) {
 	rb_cmperr(x0, y0);
 	return Qnil;		/* not reached */
@@ -249,7 +249,7 @@
     VALUE zero;
 
     zero = INT2FIX(0);
-    do_coerce(&zero, &num, Qtrue);
+    do_coerce(&zero, &num, TRUE);
 
     return rb_funcall(zero, '-', 1, num);
 }
@@ -1491,9 +1491,9 @@
 		rb_yield(DBL2NUM(i*unit+beg));
 	    }
 	}
-	return Qtrue;
+	return TRUE;
     }
-    return Qfalse;
+    return FALSE;
 }
 
 /*
@@ -1567,7 +1567,7 @@
 	    }
 	}
     }
-    else if (!ruby_float_step(from, to, step, Qfalse)) {
+    else if (!ruby_float_step(from, to, step, FALSE)) {
 	VALUE i = from;
 	ID cmp;
 
Index: bignum.c
===================================================================
--- bignum.c	(revision 24194)
+++ bignum.c	(revision 24195)
@@ -1051,7 +1051,7 @@
 VALUE
 rb_big2ulong_pack(VALUE x)
 {
-    VALUE num = big2ulong(x, "unsigned long", Qfalse);
+    VALUE num = big2ulong(x, "unsigned long", FALSE);
     if (!RBIGNUM_SIGN(x)) {
 	return (VALUE)(-(SIGNED_VALUE)num);
     }
@@ -1061,7 +1061,7 @@
 VALUE
 rb_big2ulong(VALUE x)
 {
-    VALUE num = big2ulong(x, "unsigned long", Qtrue);
+    VALUE num = big2ulong(x, "unsigned long", TRUE);
 
     if (!RBIGNUM_SIGN(x)) {
 	if ((SIGNED_VALUE)num < 0) {
@@ -1075,7 +1075,7 @@
 SIGNED_VALUE
 rb_big2long(VALUE x)
 {
-    VALUE num = big2ulong(x, "long", Qtrue);
+    VALUE num = big2ulong(x, "long", TRUE);
 
     if ((SIGNED_VALUE)num < 0 &&
 	(RBIGNUM_SIGN(x) || (SIGNED_VALUE)num != LONG_MIN)) {
@@ -2902,7 +2902,7 @@
 		if (!NIL_P(t)) return t;
 		neg = 1;
 	    }
-	    shift = big2ulong(y, "long", Qtrue);
+	    shift = big2ulong(y, "long", TRUE);
 	    break;
 	}
 	y = rb_to_int(y);
@@ -2968,7 +2968,7 @@
 	    else {
 		neg = 1;
 	    }
-	    shift = big2ulong(y, "long", Qtrue);
+	    shift = big2ulong(y, "long", TRUE);
 	    break;
 	}
 	y = rb_to_int(y);
@@ -3056,7 +3056,7 @@
 	  out_of_range:
 	    return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
 	}
-	shift = big2ulong(y, "long", Qfalse);
+	shift = big2ulong(y, "long", FALSE);
     }
     else {
 	i = NUM2LONG(y);
Index: marshal.c
===================================================================
--- marshal.c	(revision 24194)
+++ marshal.c	(revision 24195)
@@ -459,7 +459,7 @@
 {
     VALUE klass = CLASS_OF(obj);
 
-    w_extended(klass, arg, Qtrue);
+    w_extended(klass, arg, TRUE);
     klass = rb_class_real(klass);
     if (klass != super) {
 	w_byte(TYPE_UCLASS, arg);
@@ -598,8 +598,8 @@
 	w_symbol(SYM2ID(obj), arg);
     }
     else {
-	if (OBJ_TAINTED(obj)) arg->taint = Qtrue;
-	if (OBJ_UNTRUSTED(obj)) arg->untrust = Qtrue;
+	if (OBJ_TAINTED(obj)) arg->taint = TRUE;
+	if (OBJ_UNTRUSTED(obj)) arg->untrust = TRUE;
 
 	if (rb_respond_to(obj, s_mdump)) {
 	    volatile VALUE v;
@@ -608,7 +608,7 @@
 
 	    v = rb_funcall(obj, s_mdump, 0, 0);
 	    check_dump_arg(arg, s_mdump);
-	    w_class(TYPE_USRMARSHAL, obj, arg, Qfalse);
+	    w_class(TYPE_USRMARSHAL, obj, arg, FALSE);
 	    w_object(v, arg, limit);
 	    if (hasiv) w_ivar(obj, 0, &c_arg);
 	    return;
@@ -626,7 +626,7 @@
 	    if ((hasiv2 = has_ivars(v, ivtbl2)) != 0 && !hasiv) {
 		w_byte(TYPE_IVAR, arg);
 	    }
-	    w_class(TYPE_USERDEF, obj, arg, Qfalse);
+	    w_class(TYPE_USERDEF, obj, arg, FALSE);
 	    w_bytes(RSTRING_PTR(v), RSTRING_LEN(v), arg);
             if (hasiv2) {
 		w_ivar(v, ivtbl2, &c_arg);
@@ -757,7 +757,7 @@
 	    break;
 
 	  case T_STRUCT:
-	    w_class(TYPE_STRUCT, obj, arg, Qtrue);
+	    w_class(TYPE_STRUCT, obj, arg, TRUE);
 	    {
 		long len = RSTRUCT_LEN(obj);
 		VALUE mem;
@@ -773,7 +773,7 @@
 	    break;
 
 	  case T_OBJECT:
-	    w_class(TYPE_OBJECT, obj, arg, Qtrue);
+	    w_class(TYPE_OBJECT, obj, arg, TRUE);
 	    w_objivar(obj, &c_arg);
 	    break;
 
@@ -788,7 +788,7 @@
 		}
 		v = rb_funcall(obj, s_dump_data, 0);
 		check_dump_arg(arg, s_dump_data);
-		w_class(TYPE_DATA, obj, arg, Qtrue);
+		w_class(TYPE_DATA, obj, arg, TRUE);
 		w_object(v, arg, limit);
 	    }
 	    break;
@@ -883,8 +883,8 @@
     arg.dest = 0;
     arg.symbols = st_init_numtable();
     arg.data    = st_init_numtable();
-    arg.taint   = Qfalse;
-    arg.untrust = Qfalse;
+    arg.taint   = FALSE;
+    arg.untrust = FALSE;
     arg.compat_tbl = st_init_numtable();
     arg.encodings = 0;
     arg.str = rb_str_buf_new(0);
@@ -1050,8 +1050,8 @@
 	if (NIL_P(str)) goto too_short;
 	StringValue(str);
 	if (RSTRING_LEN(str) != len) goto too_short;
-	if (OBJ_TAINTED(str)) arg->taint = Qtrue;
-	if (OBJ_UNTRUSTED(str)) arg->untrust = Qtrue;
+	if (OBJ_TAINTED(str)) arg->taint = TRUE;
+	if (OBJ_UNTRUSTED(str)) arg->untrust = TRUE;
     }
     return str;
 }
@@ -1246,7 +1246,7 @@
 
       case TYPE_IVAR:
         {
-	    int ivar = Qtrue;
+	    int ivar = TRUE;
 
 	    v = r_object0(arg, &ivar, extmod);
 	    if (ivar) r_ivar(v, arg);
@@ -1396,7 +1396,7 @@
 	    v = rb_reg_new("", 0, options);
 	    if (ivp) {
 		r_ivar(v, arg);
-		*ivp = Qfalse;
+		*ivp = FALSE;
 	    }
 	    if (rb_enc_get_index(v) != rb_usascii_encindex())
 		rb_enc_copy(str, v);
@@ -1493,7 +1493,7 @@
 	    data = r_string(arg);
 	    if (ivp) {
 		r_ivar(data, arg);
-		*ivp = Qfalse;
+		*ivp = FALSE;
 	    }
 	    v = rb_funcall(klass, s_load, 1, data);
 	    check_load_arg(arg, s_load);
@@ -1542,10 +1542,10 @@
        {
            VALUE klass = path2class(r_unique(arg));
            if (rb_respond_to(klass, s_alloc)) {
-	       static int warn = Qtrue;
+	       static int warn = TRUE;
 	       if (warn) {
 		   rb_warn("define `allocate' instead of `_alloc'");
-		   warn = Qfalse;
+		   warn = FALSE;
 	       }
 	       v = rb_funcall(klass, s_alloc, 0);
 	       check_load_arg(arg, s_alloc);
@@ -1667,7 +1667,7 @@
 	if (rb_respond_to(port, s_binmode)) {
 	    rb_funcall2(port, s_binmode, 0, 0);
 	}
-	arg.taint = Qtrue;
+	arg.taint = TRUE;
     }
     else {
 	rb_raise(rb_eTypeError, "instance of IO needed");
Index: file.c
===================================================================
--- file.c	(revision 24194)
+++ file.c	(revision 24195)
@@ -885,7 +885,7 @@
 {
 #ifndef _WIN32
     if (getgid() == gid || getegid() == gid)
-	return Qtrue;
+	return TRUE;
 
 # ifdef HAVE_GETGROUPS
 #  ifndef NGROUPS
@@ -902,11 +902,11 @@
 	anum = getgroups(NGROUPS, gary);
 	while (--anum >= 0)
 	    if (gary[anum] == gid)
-		return Qtrue;
+		return TRUE;
     }
 # endif
 #endif
-    return Qfalse;
+    return FALSE;
 }
 #endif
 
@@ -4543,7 +4543,7 @@
 fpath_check(const char *path)
 {
 #if ENABLE_PATH_CHECK
-    return path_check_0(rb_str_new2(path), Qfalse);
+    return path_check_0(rb_str_new2(path), FALSE);
 #else
     return 1;
 #endif
@@ -4564,7 +4564,7 @@
     if (!p) p = pend;
 
     for (;;) {
-	if (!path_check_0(rb_str_new(p0, p - p0), Qtrue)) {
+	if (!path_check_0(rb_str_new(p0, p - p0), TRUE)) {
 	    return 0;		/* not safe */
 	}
 	p0 = p + 1;

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

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