File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -5321,8 +5321,8 @@ rb_ary_eql(VALUE ary1, VALUE ary2)
5321
5321
return rb_exec_recursive_paired (recursive_eql , ary1 , ary2 , ary2 );
5322
5322
}
5323
5323
5324
- VALUE
5325
- rb_ary_hash_values (long len , const VALUE * elements )
5324
+ static VALUE
5325
+ ary_hash_values (long len , const VALUE * elements , const VALUE ary )
5326
5326
{
5327
5327
long i ;
5328
5328
st_index_t h ;
@@ -5333,11 +5333,21 @@ rb_ary_hash_values(long len, const VALUE *elements)
5333
5333
for (i = 0 ; i < len ; i ++ ) {
5334
5334
n = rb_hash (elements [i ]);
5335
5335
h = rb_hash_uint (h , NUM2LONG (n ));
5336
+ if (ary ) {
5337
+ len = RARRAY_LEN (ary );
5338
+ elements = RARRAY_CONST_PTR (ary );
5339
+ }
5336
5340
}
5337
5341
h = rb_hash_end (h );
5338
5342
return ST2FIX (h );
5339
5343
}
5340
5344
5345
+ VALUE
5346
+ rb_ary_hash_values (long len , const VALUE * elements )
5347
+ {
5348
+ return ary_hash_values (len , elements , 0 );
5349
+ }
5350
+
5341
5351
/*
5342
5352
* call-seq:
5343
5353
* hash -> integer
@@ -5356,7 +5366,8 @@ rb_ary_hash_values(long len, const VALUE *elements)
5356
5366
static VALUE
5357
5367
rb_ary_hash (VALUE ary )
5358
5368
{
5359
- return rb_ary_hash_values (RARRAY_LEN (ary ), RARRAY_CONST_PTR (ary ));
5369
+ RBIMPL_ASSERT_OR_ASSUME (ary );
5370
+ return ary_hash_values (RARRAY_LEN (ary ), RARRAY_CONST_PTR (ary ), ary );
5360
5371
}
5361
5372
5362
5373
/*
You can’t perform that action at this time.
0 commit comments