array.c: use rb_hash_values
* array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no block is given. * internal.h: define rb_hash_values() as internal API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
827f4d653b
commit
9c6ea2f200
@ -1,3 +1,10 @@
|
|||||||
|
Tue Oct 8 16:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no
|
||||||
|
block is given.
|
||||||
|
|
||||||
|
* internal.h: define rb_hash_values() as internal API.
|
||||||
|
|
||||||
Tue Oct 8 13:53:21 2013 Masaki Matsushita <glass.saga@gmail.com>
|
Tue Oct 8 13:53:21 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||||
|
|
||||||
* array.c (rb_ary_uniq): use rb_hash_keys().
|
* array.c (rb_ary_uniq): use rb_hash_keys().
|
||||||
|
3
array.c
3
array.c
@ -4124,8 +4124,7 @@ rb_ary_uniq(VALUE ary)
|
|||||||
return rb_ary_dup(ary);
|
return rb_ary_dup(ary);
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
hash = ary_make_hash_by(ary);
|
hash = ary_make_hash_by(ary);
|
||||||
uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
|
uniq = rb_hash_values(hash);
|
||||||
st_foreach(rb_hash_tbl_raw(hash), push_value, uniq);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hash = ary_make_hash(ary);
|
hash = ary_make_hash(ary);
|
||||||
|
2
hash.c
2
hash.c
@ -1712,7 +1712,7 @@ values_i(VALUE key, VALUE value, VALUE ary)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
VALUE
|
||||||
rb_hash_values(VALUE hash)
|
rb_hash_values(VALUE hash)
|
||||||
{
|
{
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
|
@ -436,6 +436,7 @@ void rb_gc_writebarrier_remember_promoted(VALUE obj);
|
|||||||
struct st_table *rb_hash_tbl_raw(VALUE hash);
|
struct st_table *rb_hash_tbl_raw(VALUE hash);
|
||||||
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
|
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
|
||||||
VALUE rb_hash_keys(VALUE hash);
|
VALUE rb_hash_keys(VALUE hash);
|
||||||
|
VALUE rb_hash_values(VALUE hash);
|
||||||
|
|
||||||
/* inits.c */
|
/* inits.c */
|
||||||
void rb_call_inits(void);
|
void rb_call_inits(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user