1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (rb_ary_uniq): use rb_hash_keys().

* internal.h: define rb_hash_keys() as internal API.

* hash.c (rb_hash_keys): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
glass 2013-10-08 04:56:50 +00:00
parent 1fa5d76ae0
commit 41eb48b88d
4 changed files with 11 additions and 8 deletions

View file

@ -1,3 +1,11 @@
Tue Oct 8 13:53:21 2013 Masaki Matsushita <glass.saga@gmail.com>
* array.c (rb_ary_uniq): use rb_hash_keys().
* internal.h: define rb_hash_keys() as internal API.
* hash.c (rb_hash_keys): ditto.
Tue Oct 8 10:56:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* cont.c: disable FIBER_USE_NATIVE on GNU/Hurd because it doesn't

View file

@ -4130,13 +4130,7 @@ rb_ary_uniq(VALUE ary)
}
else {
hash = ary_make_hash(ary);
uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
for (i=0; i<RARRAY_LEN(ary); i++) {
st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
if (st_delete(rb_hash_tbl_raw(hash), &vv, 0)) {
rb_ary_push(uniq, v);
}
}
uniq = rb_hash_keys(hash);
}
ary_recycle_hash(hash);

2
hash.c
View file

@ -1682,7 +1682,7 @@ keys_i(VALUE key, VALUE value, VALUE ary)
*
*/
static VALUE
VALUE
rb_hash_keys(VALUE hash)
{
VALUE ary;

View file

@ -435,6 +435,7 @@ void rb_gc_writebarrier_remember_promoted(VALUE obj);
/* hash.c */
struct st_table *rb_hash_tbl_raw(VALUE hash);
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
VALUE rb_hash_keys(VALUE hash);
/* inits.c */
void rb_call_inits(void);