From e6583117df95373cffb12105de82d3816ca09f85 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 11 Jan 2017 08:53:31 -0300 Subject: Both Array and Dictionary are always in shared mode (removed copy on write). --- core/array.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'core/array.cpp') diff --git a/core/array.cpp b/core/array.cpp index 50cc9eee4..b9c8f543d 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -36,7 +36,6 @@ struct ArrayPrivate { SafeRefCount refcount; Vector array; - bool shared; }; void Array::_ref(const Array& p_from) const { @@ -54,20 +53,9 @@ void Array::_ref(const Array& p_from) const { _unref(); - if (_fp->shared) { + _p = p_from._p; - _p = p_from._p; - } else { - - _p = memnew( ArrayPrivate ); - _p->shared=false; - _p->refcount.init(); - _p->array=_fp->array; - - if (_fp->refcount.unref()) - memdelete(_fp); - } } void Array::_unref() const { @@ -106,10 +94,6 @@ void Array::clear() { _p->array.clear(); } -bool Array::is_shared() const { - - return _p->shared; -} bool Array::operator==(const Array& p_array) const { @@ -316,11 +300,11 @@ Array::Array(const Array& p_from) { _ref(p_from); } -Array::Array(bool p_shared) { +Array::Array() { _p = memnew( ArrayPrivate ); _p->refcount.init(); - _p->shared=p_shared; + } Array::~Array() { -- cgit v1.2.3-70-g09d2