[macruby-changes] [2928] MacRuby/trunk/array.c
source_changes at macosforge.org
source_changes at macosforge.org
Thu Oct 29 23:50:57 PDT 2009
Revision: 2928
http://trac.macosforge.org/projects/ruby/changeset/2928
Author: lsansonetti at apple.com
Date: 2009-10-29 23:50:54 -0700 (Thu, 29 Oct 2009)
Log Message:
-----------
rb_ary_delete(): never yield current block
Modified Paths:
--------------
MacRuby/trunk/array.c
Modified: MacRuby/trunk/array.c
===================================================================
--- MacRuby/trunk/array.c 2009-10-30 06:34:54 UTC (rev 2927)
+++ MacRuby/trunk/array.c 2009-10-30 06:50:54 UTC (rev 2928)
@@ -2224,8 +2224,8 @@
* a.delete("z") { "not found" } #=> "not found"
*/
-static VALUE
-rb_ary_delete_imp(VALUE ary, SEL sel, VALUE item)
+static inline bool
+rb_ary_delete0(VALUE ary, VALUE item)
{
rb_ary_modify(ary);
@@ -2252,6 +2252,14 @@
changed = true;
}
}
+
+ return changed;
+}
+
+static VALUE
+rb_ary_delete_imp(VALUE ary, SEL sel, VALUE item)
+{
+ const bool changed = rb_ary_delete0(ary, item);
if (!changed) {
if (rb_block_given_p()) {
return rb_yield(item);
@@ -2264,7 +2272,7 @@
VALUE
rb_ary_delete(VALUE ary, VALUE item)
{
- return rb_ary_delete_imp(ary, 0, item);
+ return rb_ary_delete0(ary, item) ? item : Qnil;
}
VALUE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091029/d10cb20c/attachment.html>
More information about the macruby-changes
mailing list