Skip to content

Commit

Permalink
* array.c (rb_ary_uniq): use rb_hash_keys().
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
glass committed Oct 8, 2013
1 parent 1fa5d76 commit 41eb48b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 1 addition & 7 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ keys_i(VALUE key, VALUE value, VALUE ary)
*
*/

static VALUE
VALUE
rb_hash_keys(VALUE hash)
{
VALUE ary;
Expand Down
1 change: 1 addition & 0 deletions internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 41eb48b

Please sign in to comment.