mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
39c871c925
commit
3be03e9294
5 changed files with 26 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
|||
Wed Nov 3 17:19:59 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* 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 <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk.rb: support to use different Tcl commands between
|
||||
|
|
22
array.c
22
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; i<RARRAY(ary1)->len; 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; i<RARRAY(ary1)->len; 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; i<RARRAY(ary2)->len; 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; i<RARRAY(ary)->len; 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
4
string.c
4
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<<bits)-1;
|
||||
sum &= (((unsigned long)1)<<bits)-1;
|
||||
}
|
||||
return rb_int2inum(sum);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue