• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

mrubyを超漢字で動作させる


Commit MetaInfo

修訂1300770cec6b6a20c33dc54c9c01fc07c5097088 (tree)
時間2014-07-06 19:30:29
作者Yukihiro "Matz" Matsumoto <matz@ruby...>
CommiterYukihiro "Matz" Matsumoto

Log Message

Merge pull request #2447 from take-cheeze/reduce_ary_clear_alloc

Reduce allocation in shared RArray clearing.

Change Summary

差異

--- a/src/array.c
+++ b/src/array.c
@@ -902,10 +902,14 @@ mrb_ary_clear(mrb_state *mrb, mrb_value self)
902902 {
903903 struct RArray *a = mrb_ary_ptr(self);
904904
905- ary_modify(mrb, a);
905+ if (ARY_SHARED_P(a)) {
906+ mrb_ary_decref(mrb, a->aux.shared);
907+ ARY_UNSET_SHARED_FLAG(a);
908+ } else {
909+ mrb_free(mrb, a->ptr);
910+ }
906911 a->len = 0;
907912 a->aux.capa = 0;
908- mrb_free(mrb, a->ptr);
909913 a->ptr = 0;
910914
911915 return self;