ruby-changes:5018
From: knu <ko1@a...>
Date: Thu, 22 May 2008 02:28:12 +0900 (JST)
Subject: [ruby-changes:5018] knu - Ruby:r16511 (ruby_1_8_7): Merge from ruby_1_8.
knu 2008-05-22 02:27:56 +0900 (Thu, 22 May 2008)
New Revision: 16511
Modified files:
branches/ruby_1_8_7/ChangeLog
branches/ruby_1_8_7/eval.c
branches/ruby_1_8_7/file.c
branches/ruby_1_8_7/gc.c
branches/ruby_1_8_7/hash.c
branches/ruby_1_8_7/io.c
branches/ruby_1_8_7/parse.y
branches/ruby_1_8_7/signal.c
branches/ruby_1_8_7/version.h
Log:
Merge from ruby_1_8.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/hash.c?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/io.c?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/parse.y?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/gc.c?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/eval.c?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/signal.c?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/ChangeLog?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/file.c?r1=16511&r2=16510&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/version.h?r1=16511&r2=16510&diff_format=u
Index: ruby_1_8_7/parse.y
===================================================================
--- ruby_1_8_7/parse.y (revision 16510)
+++ ruby_1_8_7/parse.y (revision 16511)
@@ -6128,6 +6128,7 @@
ID id;
{
char *name;
+ st_data_t data;
if (id < tLAST_TOKEN) {
int i;
@@ -6138,8 +6139,8 @@
}
}
- if (st_lookup(sym_rev_tbl, id, (st_data_t *)&name))
- return name;
+ if (st_lookup(sym_rev_tbl, id, &data))
+ return (char *)data;
if (is_attrset_id(id)) {
ID id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL;
@@ -6352,7 +6353,7 @@
{
NODE **prev = &parser_heap, *n;
- while (n = *prev) {
+ while ((n = *prev) != 0) {
if (n->u1.node == ptr) {
*prev = n->u2.node;
rb_gc_force_recycle((VALUE)n);
Index: ruby_1_8_7/hash.c
===================================================================
--- ruby_1_8_7/hash.c (revision 16510)
+++ ruby_1_8_7/hash.c (revision 16511)
@@ -702,10 +702,9 @@
* hsh.delete(key) {| key | block } => value
*
* Deletes and returns a key-value pair from <i>hsh</i> whose key is
- * equal to <i>key</i>. If the key is not found, returns the
- * <em>default value</em>. If the optional code block is given and the
- * key is not found, pass in the key and return the result of
- * <i>block</i>.
+ * equal to <i>key</i>. If the key is not found, returns <code>nil</code>.
+ * If the optional code block is given and the key is not found,
+ * pass in the key and return the result of <i>block</i>.
*
* h = { "a" => 100, "b" => 200 }
* h.delete("a") #=> 100
Index: ruby_1_8_7/ChangeLog
===================================================================
--- ruby_1_8_7/ChangeLog (revision 16510)
+++ ruby_1_8_7/ChangeLog (revision 16511)
@@ -1,3 +1,23 @@
+Wed May 21 23:31:44 2008 Nobuyoshi Nakada <nobu@r...>
+
+ * eval.c (rb_get_method_body, rb_alias, rb_eval): should not cache
+ uninitialized value, since search_method doesn't set origin if the
+ method wasn't found.
+
+ * eval.c (search_method, remove_method, error_print, rb_alias)
+ (rb_eval, rb_rescue2, search_required, Init_eval, rb_thread_create),
+ gc.c (rb_source_filename, Init_stack), io.c (rb_io_getline),
+ parse.y (rb_id2name, rb_parser_free): suppress warnings.
+
+Wed May 21 12:34:51 2008 Nobuyoshi Nakada <nobu@r...>
+
+ * hash.c (rb_hash_delete): rdoc fix based on a patch from Gaston Ramos
+ <ramos.gaston AT gmail.com>. [ruby-core:16825]
+
+Tue May 20 13:15:46 2008 Akinori MUSHA <knu@i...>
+
+ * file.c (lchmod_internal): Remove a compiler warning.
+
Mon May 19 18:22:35 2008 Akinori MUSHA <knu@i...>
* ext/openssl/ossl_pkcs5.c (ossl_pkcs5_pbkdf2_hmac): Fix the type
Index: ruby_1_8_7/version.h
===================================================================
--- ruby_1_8_7/version.h (revision 16510)
+++ ruby_1_8_7/version.h (revision 16511)
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2008-05-19"
+#define RUBY_RELEASE_DATE "2008-05-22"
#define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20080519
+#define RUBY_RELEASE_CODE 20080522
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 19
+#define RUBY_RELEASE_DAY 22
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8_7/io.c
===================================================================
--- ruby_1_8_7/io.c (revision 16510)
+++ ruby_1_8_7/io.c (revision 16511)
@@ -1723,7 +1723,7 @@
while ((c = appendline(fptr, newline, &str)) != EOF &&
(c != newline || RSTRING(str)->len < rslen ||
- (rspara || rscheck(rsptr,rslen,rs), 0) ||
+ ((rspara || rscheck(rsptr,rslen,rs)) && 0) ||
memcmp(RSTRING(str)->ptr+RSTRING(str)->len-rslen,rsptr,rslen)));
if (rspara) {
Index: ruby_1_8_7/signal.c
===================================================================
--- ruby_1_8_7/signal.c (revision 16510)
+++ ruby_1_8_7/signal.c (revision 16511)
@@ -271,9 +271,9 @@
static VALUE
interrupt_init(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
VALUE args[2];
@@ -572,17 +572,18 @@
#if defined(HAVE_NATIVETHREAD) && defined(HAVE_NATIVETHREAD_KILL)
if (!is_ruby_native_thread() && !rb_trap_accept_nativethreads[sig]) {
- sigsend_to_ruby_thread(sig);
- return;
+ sigsend_to_ruby_thread(sig);
+ return;
}
#endif
#if !defined(BSD_SIGNAL) && !defined(POSIX_SIGNAL)
if (rb_trap_accept_nativethreads[sig]) {
- ruby_nativethread_signal(sig, sighandler);
- } else {
- ruby_signal(sig, sighandler);
+ ruby_nativethread_signal(sig, sighandler);
}
+ else {
+ ruby_signal(sig, sighandler);
+ }
#endif
if (trap_list[sig].cmd == 0 && ATOMIC_TEST(rb_trap_immediate)) {
Index: ruby_1_8_7/file.c
===================================================================
--- ruby_1_8_7/file.c (revision 16510)
+++ ruby_1_8_7/file.c (revision 16511)
@@ -1785,7 +1785,7 @@
const char *path;
void *mode;
{
- if (lchmod(path, (int)mode) < 0)
+ if (lchmod(path, (int)(VALUE)mode) < 0)
rb_sys_fail(path);
}
Index: ruby_1_8_7/eval.c
===================================================================
--- ruby_1_8_7/eval.c (revision 16510)
+++ ruby_1_8_7/eval.c (revision 16511)
@@ -467,16 +467,16 @@
VALUE klass, *origin;
ID id;
{
- NODE *body;
+ st_data_t body;
if (!klass) return 0;
- while (!st_lookup(RCLASS(klass)->m_tbl, id, (st_data_t *)&body)) {
+ while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
klass = RCLASS(klass)->super;
if (!klass) return 0;
}
if (origin) *origin = klass;
- return body;
+ return (NODE *)body;
}
static NODE*
@@ -487,7 +487,7 @@
{
ID id = *idp;
VALUE klass = *klassp;
- VALUE origin;
+ VALUE origin = 0;
NODE * volatile body;
struct cache_entry *ent;
@@ -555,7 +555,8 @@
VALUE klass;
ID mid;
{
- NODE *body;
+ st_data_t data;
+ NODE *body = 0;
if (klass == rb_cObject) {
rb_secure(4);
@@ -567,10 +568,11 @@
if (mid == __id__ || mid == __send__ || mid == init) {
rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
}
- if (st_lookup(RCLASS(klass)->m_tbl, mid, (st_data_t *)&body)) {
+ if (st_lookup(RCLASS(klass)->m_tbl, mid, &data)) {
+ body = (NODE *)data;
if (!body || !body->nd_body) body = 0;
else {
- st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body);
+ st_delete(RCLASS(klass)->m_tbl, &mid, &data);
}
}
if (!body) {
@@ -1286,7 +1288,7 @@
long len = elen;
if (RSTRING(epath)->ptr[0] == '#') epath = 0;
- if (tail = memchr(einfo, '\n', elen)) {
+ if ((tail = memchr(einfo, '\n', elen)) != 0) {
len = tail - einfo;
tail++; /* skip newline */
}
@@ -2159,9 +2161,10 @@
VALUE klass;
ID name, def;
{
- VALUE origin;
+ VALUE origin = 0;
NODE *orig, *body, *node;
VALUE singleton = 0;
+ st_data_t data;
rb_frozen_class_p(klass);
if (name == def) return;
@@ -2189,7 +2192,8 @@
}
rb_clear_cache_by_id(name);
- if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *)&node)) {
+ if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, &data)) {
+ node = (NODE *)data;
if (node->nd_cnt == 0 && node->nd_body) {
rb_warning("discarding old %s", rb_id2name(name));
}
@@ -2940,6 +2944,7 @@
NODE * volatile node = n;
int state;
volatile VALUE result = Qnil;
+ st_data_t data;
#define RETURN(v) do { \
result = (v); \
@@ -3916,7 +3921,7 @@
case NODE_DEFN:
if (node->nd_defn) {
NODE *body, *defn;
- VALUE origin;
+ VALUE origin = 0;
int noex;
if (NIL_P(ruby_class)) {
@@ -3978,7 +3983,8 @@
if (OBJ_FROZEN(recv)) rb_error_frozen("object");
klass = rb_singleton_class(recv);
- if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, (st_data_t *)&body)) {
+ if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &data)) {
+ body = (NODE *)data;
if (ruby_safe_level >= 4) {
rb_raise(rb_eSecurityError, "redefining method prohibited");
}
@@ -5441,7 +5447,7 @@
if (handle) break;
handle = Qfalse;
va_init_list(args, data2);
- while (eclass = va_arg(args, VALUE)) {
+ while ((eclass = va_arg(args, VALUE)) != 0) {
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
handle = Qtrue;
break;
@@ -7206,7 +7212,7 @@
#else
rb_str_cat2(tmp, DLEXT);
OBJ_FREEZE(tmp);
- if (*path = rb_find_file(tmp)) {
+ if ((*path = rb_find_file(tmp)) != 0) {
return 's';
}
#endif
@@ -8058,11 +8064,11 @@
__id__ = rb_intern("__id__");
__send__ = rb_intern("__send__");
- rb_global_variable((VALUE*)&top_scope);
- rb_global_variable((VALUE*)&ruby_eval_tree_begin);
+ rb_global_variable((void *)&top_scope);
+ rb_global_variable((void *)&ruby_eval_tree_begin);
- rb_global_variable((VALUE*)&ruby_eval_tree);
- rb_global_variable((VALUE*)&ruby_dyna_vars);
+ rb_global_variable((void *)&ruby_eval_tree);
+ rb_global_variable((void *)&ruby_dyna_vars);
rb_define_virtual_variable("$@", errat_getter, errat_setter);
rb_define_hooked_variable("$!", &ruby_errinfo, 0, errinfo_setter);
@@ -8075,7 +8081,7 @@
rb_define_method(rb_mKernel, "respond_to?", obj_respond_to, -1);
respond_to = rb_intern("respond_to?");
- rb_global_variable((VALUE*)&basic_respond_to);
+ rb_global_variable((void *)&basic_respond_to);
basic_respond_to = rb_method_node(rb_cObject, respond_to);
rb_define_global_function("raise", rb_f_raise, -1);
@@ -11958,7 +11964,7 @@
return th;
}
-static int thread_init = 0;
+static int thread_init;
#if defined(_THREAD_SAFE)
static void
@@ -12171,7 +12177,7 @@
VALUE (*fn)();
void *arg;
{
- Init_stack((VALUE*)&arg);
+ Init_stack((void *)&arg);
return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
}
Index: ruby_1_8_7/gc.c
===================================================================
--- ruby_1_8_7/gc.c (revision 16510)
+++ ruby_1_8_7/gc.c (revision 16511)
@@ -565,17 +565,18 @@
rb_source_filename(f)
const char *f;
{
- char *name;
+ st_data_t name;
- if (!st_lookup(source_filenames, (st_data_t)f, (st_data_t *)&name)) {
+ if (!st_lookup(source_filenames, (st_data_t)f, &name)) {
long len = strlen(f) + 1;
- char *ptr = name = ALLOC_N(char, len + 1);
+ char *ptr = ALLOC_N(char, len + 1);
+ name = (st_data_t)ptr;
*ptr++ = 0;
MEMCPY(ptr, f, char, len);
- st_add_direct(source_filenames, (st_data_t)ptr, (st_data_t)name);
+ st_add_direct(source_filenames, (st_data_t)ptr, name);
return ptr;
}
- return name + 1;
+ return (char *)name + 1;
}
static void
@@ -1295,7 +1296,7 @@
if (RANY(obj)->as.scope.local_vars &&
RANY(obj)->as.scope.flags != SCOPE_ALLOCA) {
VALUE *vars = RANY(obj)->as.scope.local_vars-1;
- if (!(RANY(obj)->as.scope.flags & SCOPE_CLONE) && vars[0] == 0)
+ if (!(RANY(obj)->as.scope.flags & SCOPE_CLONE) && vars[0] == 0)
RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
if (RANY(obj)->as.scope.flags & SCOPE_MALLOC)
RUBY_CRITICAL(free(vars));
@@ -1527,7 +1528,7 @@
rb_gc_stack_start = STACK_END_ADDRESS;
}
#else
- if (!addr) addr = (VALUE *)&addr;
+ if (!addr) addr = (void *)&addr;
STACK_UPPER(&addr, addr, ++addr);
if (rb_gc_stack_start) {
if (STACK_UPPER(&addr,
@@ -1650,7 +1651,7 @@
p = heaps[i].slot; pend = p + heaps[i].limit;
for (;p < pend; p++) {
if (p->as.basic.flags) {
- switch (TYPE(p)) {
+ switch (BUILTIN_TYPE(p)) {
case T_NONE:
case T_ICLASS:
case T_VARMAP:
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/