summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-21 17:27:56 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-21 17:27:56 +0000
commitb524523217b51e864c010646ffd5cbc4154d2fd3 (patch)
tree70844b11aaa2e3c6d67f9628e4b011a322900039
parent1d78315845bcc7800315acbeb6b0a804e745a257 (diff)
Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog20
-rw-r--r--eval.c48
-rw-r--r--file.c2
-rw-r--r--gc.c17
-rw-r--r--hash.c7
-rw-r--r--io.c2
-rw-r--r--parse.y7
-rw-r--r--signal.c17
-rw-r--r--version.h6
9 files changed, 77 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index f1214b7579..c4f198c0ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Wed May 21 23:31:44 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
+
+ * 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@iDaemons.org>
+
+ * file.c (lchmod_internal): Remove a compiler warning.
+
Mon May 19 18:22:35 2008 Akinori MUSHA <knu@iDaemons.org>
* ext/openssl/ossl_pkcs5.c (ossl_pkcs5_pbkdf2_hmac): Fix the type
diff --git a/eval.c b/eval.c
index d9c9218dd7..e52bc2c6e8 100644
--- a/eval.c
+++ b/eval.c
@@ -467,16 +467,16 @@ search_method(klass, id, origin)
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 @@ rb_get_method_body(klassp, idp, noexp)
{
ID id = *idp;
VALUE klass = *klassp;
- VALUE origin;
+ VALUE origin = 0;
NODE * volatile body;
struct cache_entry *ent;
@@ -555,7 +555,8 @@ remove_method(klass, mid)
VALUE klass;
ID mid;
{
- NODE *body;
+ st_data_t data;
+ NODE *body = 0;
if (klass == rb_cObject) {
rb_secure(4);
@@ -567,10 +568,11 @@ remove_method(klass, mid)
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 @@ error_print()
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 @@ rb_alias(klass, name, def)
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_alias(klass, name, def)
}
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 @@ rb_eval(self, n)
NODE * volatile node = n;
int state;
volatile VALUE result = Qnil;
+ st_data_t data;
#define RETURN(v) do { \
result = (v); \
@@ -3916,7 +3921,7 @@ rb_eval(self, n)
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 @@ rb_eval(self, n)
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 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
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 @@ search_required(fname, featurep, path)
#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 @@ Init_eval()
__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 @@ Init_eval()
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 @@ rb_thread_alloc(klass)
return th;
}
-static int thread_init = 0;
+static int thread_init;
#if defined(_THREAD_SAFE)
static void
@@ -12171,7 +12177,7 @@ rb_thread_create(fn, arg)
VALUE (*fn)();
void *arg;
{
- Init_stack((VALUE*)&arg);
+ Init_stack((void *)&arg);
return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
}
diff --git a/file.c b/file.c
index 71d5692c66..ba00e9d34a 100644
--- a/file.c
+++ b/file.c
@@ -1785,7 +1785,7 @@ lchmod_internal(path, mode)
const char *path;
void *mode;
{
- if (lchmod(path, (int)mode) < 0)
+ if (lchmod(path, (int)(VALUE)mode) < 0)
rb_sys_fail(path);
}
diff --git a/gc.c b/gc.c
index daf3bcd51f..1ff9cadba2 100644
--- a/gc.c
+++ b/gc.c
@@ -565,17 +565,18 @@ char *
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 @@ obj_free(obj)
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 @@ Init_stack(addr)
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 @@ os_obj_of(of)
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:
diff --git a/hash.c b/hash.c
index 5a3d7ecfab..75db4d6b4f 100644
--- a/hash.c
+++ b/hash.c
@@ -702,10 +702,9 @@ rb_hash_indexes(argc, argv, hash)
* 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
diff --git a/io.c b/io.c
index 6d7ba83838..83e748f633 100644
--- a/io.c
+++ b/io.c
@@ -1723,7 +1723,7 @@ rb_io_getline(rs, io)
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) {
diff --git a/parse.y b/parse.y
index 37a61df98a..1d32a7bede 100644
--- a/parse.y
+++ b/parse.y
@@ -6128,6 +6128,7 @@ rb_id2name(id)
ID id;
{
char *name;
+ st_data_t data;
if (id < tLAST_TOKEN) {
int i;
@@ -6138,8 +6139,8 @@ rb_id2name(id)
}
}
- 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 @@ rb_parser_free(ptr)
{
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);
diff --git a/signal.c b/signal.c
index 81fb280a09..351cdc4600 100644
--- a/signal.c
+++ b/signal.c
@@ -271,9 +271,9 @@ esignal_init(argc, argv, self)
static VALUE
interrupt_init(argc, argv, self)
- int argc;
- VALUE *argv;
- VALUE self;
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
VALUE args[2];
@@ -572,16 +572,17 @@ sighandler(sig)
#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
diff --git a/version.h b/version.h
index 592edb6348..e26909132d 100644
--- a/version.h
+++ b/version.h
@@ -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[];