From 3be03e9294e208bb0f158a1dd91c31e93dcd96fd Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 3 Nov 2004 11:34:57 +0000 Subject: [PATCH] * array.c (rb_ary_uniq_bang): do not push frozen string from hash table. [ruby-dev:24695] * array.c (rb_ary_and): ditto. * array.c (rb_ary_or): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ array.c | 22 +++++++++++----------- lib/irb/ruby-lex.rb | 3 +++ regexec.c | 2 +- string.c | 4 ++-- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1e8548df7..6eabf6997d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed Nov 3 17:19:59 2004 Yukihiro Matsumoto + + * array.c (rb_ary_uniq_bang): do not push frozen string from hash + table. [ruby-dev:24695] + + * array.c (rb_ary_and): ditto. + + * array.c (rb_ary_or): ditto. + Wed Nov 3 17:02:48 2004 Hidetoshi NAGAI * ext/tk/lib/tk.rb: support to use different Tcl commands between diff --git a/array.c b/array.c index dc5f65e435..ec8a06a20a 100644 --- a/array.c +++ b/array.c @@ -2796,7 +2796,7 @@ static VALUE rb_ary_and(ary1, ary2) VALUE ary1, ary2; { - VALUE hash, ary3; + VALUE hash, ary3, v, vv; long i; ary2 = to_ary(ary2); @@ -2805,8 +2805,8 @@ rb_ary_and(ary1, ary2) hash = ary_make_hash(ary2, 0); for (i=0; ilen; i++) { - VALUE v = rb_ary_elt(ary1, i); - if (st_delete(RHASH(hash)->tbl, (st_data_t*)&v, 0)) { + v = vv = rb_ary_elt(ary1, i); + if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) { rb_ary_push(ary3, v); } } @@ -2830,7 +2830,7 @@ rb_ary_or(ary1, ary2) VALUE ary1, ary2; { VALUE hash, ary3; - VALUE v; + VALUE v, vv; long i; ary2 = to_ary(ary2); @@ -2838,14 +2838,14 @@ rb_ary_or(ary1, ary2) hash = ary_make_hash(ary1, ary2); for (i=0; ilen; i++) { - v = rb_ary_elt(ary1, i); - if (st_delete(RHASH(hash)->tbl, (st_data_t*)&v, 0)) { + v = vv = rb_ary_elt(ary1, i); + if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) { rb_ary_push(ary3, v); } } for (i=0; ilen; i++) { - v = rb_ary_elt(ary2, i); - if (st_delete(RHASH(hash)->tbl, (st_data_t*)&v, 0)) { + v = vv = rb_ary_elt(ary2, i); + if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) { rb_ary_push(ary3, v); } } @@ -2870,7 +2870,7 @@ static VALUE rb_ary_uniq_bang(ary) VALUE ary; { - VALUE hash; + VALUE hash, v, vv; long i, j; rb_ary_modify(ary); @@ -2881,8 +2881,8 @@ rb_ary_uniq_bang(ary) return Qnil; } for (i=j=0; ilen; i++) { - VALUE v = rb_ary_elt(ary, i); - if (st_delete(RHASH(hash)->tbl, (st_data_t*)&v, 0)) { + v = vv = rb_ary_elt(ary, i); + if (st_delete(RHASH(hash)->tbl, (st_data_t*)&vv, 0)) { rb_ary_store(ary, j++, v); } } diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 5a1ede7e3f..e25af30546 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -55,6 +55,9 @@ class RubyLex @skip_space = false @readed_auto_clean_up = false @exception_on_syntax_error = true + @prompt = nil + @here_header = nil + @lex_state = nil end attr_accessor :skip_space diff --git a/regexec.c b/regexec.c index a0625fdf7e..5d759032e8 100644 --- a/regexec.c +++ b/regexec.c @@ -254,7 +254,7 @@ onig_region_copy(OnigRegion* to, OnigRegion* from) /** stack **/ #define INVALID_STACK_INDEX -1 -typedef int StackIndex; +typedef long StackIndex; typedef struct _StackType { unsigned int type; diff --git a/string.c b/string.c index 43c8f7908a..6592421f43 100644 --- a/string.c +++ b/string.c @@ -4453,7 +4453,7 @@ rb_str_sum(argc, argv, str) return sum; } else { - unsigned int sum = 0; + unsigned long sum = 0; while (p < pend) { str_mod_check(str, ptr, len); @@ -4461,7 +4461,7 @@ rb_str_sum(argc, argv, str) p++; } if (bits != 0) { - sum &= (1<