From: "naruse (Yui NARUSE)" Date: 2012-06-08T05:13:27+09:00 Subject: [ruby-core:45490] [ruby-trunk - Feature #6557][Feedback] Make rb_hash_clear() public Issue #6557 has been updated by naruse (Yui NARUSE). Status changed from Open to Feedback ibc (I��aki Baz Castillo) wrote: > Any reason for rb_hash_clear() not to be public C API?: Because anyone hadn't request it to be public. If a function is a public, we can't change the API. So we don't make it public until anyone request it. Now you request, could you show the use case of rb_hash_clear() ? ---------------------------------------- Feature #6557: Make rb_hash_clear() public https://bugs.ruby-lang.org/issues/6557#change-27077 Author: ibc (I��aki Baz Castillo) Status: Feedback Priority: Normal Assignee: Category: core Target version: 1.9.3 Any reason for rb_hash_clear() not to be public C API?:
static VALUE
rb_hash_clear(VALUE hash)
{
    rb_hash_modify_check(hash);
    if (!RHASH(hash)->ntbl)
        return hash;
    if (RHASH(hash)->ntbl->num_entries > 0) {
        if (RHASH(hash)->iter_lev > 0)
            rb_hash_foreach(hash, clear_i, 0);
        else
            st_clear(RHASH(hash)->ntbl);
    }

    return hash;
}
-- http://bugs.ruby-lang.org/