Issue #6557 has been reported by ibc (Iñaki Baz Castillo). ---------------------------------------- Feature #6557: Make rb_hash_clear() public https://bugs.ruby-lang.org/issues/6557 Author: ibc (Iñaki Baz Castillo) Status: Open Priority: Normal Assignee: Category: core Target version: 1.9.3 Any reason for rb_hash_clear() not to be public C API?: <pre> 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; } </pre>
on 2012-06-07 19:22
on 2012-06-07 19:31
Issue #6557 has been updated by ibc (Iñaki Baz Castillo). The same for rb_hash_size(). ---------------------------------------- Feature #6557: Make rb_hash_clear() public https://bugs.ruby-lang.org/issues/6557#change-27071 Author: ibc (Iñaki Baz Castillo) Status: Open Priority: Normal Assignee: Category: core Target version: 1.9.3 Any reason for rb_hash_clear() not to be public C API?: <pre> 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; } </pre>
on 2012-06-07 22:14
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?: <pre> 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; } </pre>
on 2012-06-07 23:34
Issue #6557 has been updated by ibc (Iñaki Baz Castillo). Well, I have a C extension (a reactor based on libuv) in which I would like to perform the "loop release" within a single C function (to avoid some steps of the function to be interrupted by an exception or whatever). In such a "release" function I must clear some Ruby arrays and hashes. Note that rb_ary_clear() is public. PS: BTW, I don't receive mails when somebody comments or updates an issue reported by me, is it normal? I use Redmine so I'm sure I've properly configured my account in this Redmine. Thanks a lot. ---------------------------------------- Feature #6557: Make rb_hash_clear() public https://bugs.ruby-lang.org/issues/6557#change-27079 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?: <pre> 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; } </pre>
on 2012-11-24 06:18
Issue #6557 has been updated by mame (Yusuke Endoh). Status changed from Feedback to Closed Congrats, rb_hash_clear() was public since r37480. -- Yusuke Endoh <mame@tsg.ne.jp> ---------------------------------------- Feature #6557: Make rb_hash_clear() public https://bugs.ruby-lang.org/issues/6557#change-33791 Author: ibc (Iñaki Baz Castillo) Status: Closed Priority: Normal Assignee: Category: core Target version: 1.9.3 Any reason for rb_hash_clear() not to be public C API?: <pre> 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; } </pre>
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.