diff --git a/ChangeLog b/ChangeLog index 6f2264bfe7..eb1357e880 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,9 +41,6 @@ Sat Dec 20 02:18:31 2003 Yukihiro Matsumoto * misc/ruby-mode.el (ruby-calculate-indent): proper indentation inside of parentheses. [ruby-dev:22308] - * hash.c (delete_if_i): do not use ST_DELETE for thread safety. - [ruby-dev:21899] (not fully solved) - Fri Dec 19 21:24:22 2003 GOTOU Yuuzou * lib/webrick/httprequest.rb (HTTPRequest#meta_vars): should not set diff --git a/dln.c b/dln.c index 5f7982051e..1dd80c2fe6 100644 --- a/dln.c +++ b/dln.c @@ -91,7 +91,7 @@ char *getenv(); int eaccess(); -+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP) +#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP) /* dynamic load with dlopen() */ # define USE_DLN_DLOPEN #endif diff --git a/gc.c b/gc.c index 8d337cd57a..9e4ac5ae38 100644 --- a/gc.c +++ b/gc.c @@ -236,6 +236,8 @@ rb_gc_unregister_address(addr) } } +#undef GC_DEBUG + void rb_global_variable(var) VALUE *var; @@ -266,6 +268,10 @@ typedef struct RVALUE { struct RVarmap varmap; struct SCOPE scope; } as; +#ifdef GC_DEBUG + char *file; + int line; +#endif } RVALUE; static RVALUE *freelist = 0; @@ -346,6 +352,10 @@ rb_newobj() obj = (VALUE)freelist; freelist = freelist->as.free.next; MEMZERO((void*)obj, RVALUE, 1); +#ifdef GC_DEBUG + RANY(obj)->file = ruby_sourcefile; + RANY(obj)->line = ruby_sourceline; +#endif return obj; } diff --git a/hash.c b/hash.c index 48c0aba7ac..102682c0b3 100644 --- a/hash.c +++ b/hash.c @@ -460,12 +460,12 @@ rb_hash_shift(hash) } static enum st_retval -delete_if_i(key, value, keys) - VALUE key, value, keys; +delete_if_i(key, value) + VALUE key, value; { - if (key != Qundef && RTEST(rb_yield_values(2, key, value))) { - rb_ary_push(keys, key); - } + if (key == Qundef) return ST_CONTINUE; + if (RTEST(rb_yield_values(2, key, value))) + return ST_DELETE; return ST_CONTINUE; } @@ -473,14 +473,8 @@ VALUE rb_hash_delete_if(hash) VALUE hash; { - VALUE keys = rb_ary_new(); - long i; - rb_hash_modify(hash); - rb_hash_foreach(hash, delete_if_i, keys); - for (i=0; ilen; i++) { - st_delete(RHASH(hash)->tbl, &RARRAY(keys)->ptr[i], 0); - } + rb_hash_foreach(hash, delete_if_i, 0); return hash; }