diff options
Diffstat (limited to 'core/cowdata.h')
-rw-r--r-- | core/cowdata.h | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/core/cowdata.h b/core/cowdata.h index b63a407511..72a76d735d 100644 --- a/core/cowdata.h +++ b/core/cowdata.h @@ -59,7 +59,6 @@ private: // internal helpers _FORCE_INLINE_ uint32_t *_get_refcount() const { - if (!_ptr) return nullptr; @@ -67,7 +66,6 @@ private: } _FORCE_INLINE_ uint32_t *_get_size() const { - if (!_ptr) return nullptr; @@ -75,7 +73,6 @@ private: } _FORCE_INLINE_ T *_get_data() const { - if (!_ptr) return nullptr; return reinterpret_cast<T *>(_ptr); @@ -135,21 +132,18 @@ public: _FORCE_INLINE_ bool empty() const { return _ptr == nullptr; } _FORCE_INLINE_ void set(int p_index, const T &p_elem) { - CRASH_BAD_INDEX(p_index, size()); _copy_on_write(); _get_data()[p_index] = p_elem; } _FORCE_INLINE_ T &get_m(int p_index) { - CRASH_BAD_INDEX(p_index, size()); _copy_on_write(); return _get_data()[p_index]; } _FORCE_INLINE_ const T &get(int p_index) const { - CRASH_BAD_INDEX(p_index, size()); return _get_data()[p_index]; @@ -158,12 +152,10 @@ public: Error resize(int p_size); _FORCE_INLINE_ void remove(int p_index) { - ERR_FAIL_INDEX(p_index, size()); T *p = ptrw(); int len = size(); for (int i = p_index; i < len - 1; i++) { - p[i] = p[i + 1]; }; @@ -171,7 +163,6 @@ public: }; Error insert(int p_pos, const T &p_val) { - ERR_FAIL_INDEX_V(p_pos, size() + 1, ERR_INVALID_PARAMETER); resize(size() + 1); for (int i = (size() - 1); i > p_pos; i--) @@ -190,7 +181,6 @@ public: template <class T> void CowData<T>::_unref(void *p_data) { - if (!p_data) return; @@ -216,7 +206,6 @@ void CowData<T>::_unref(void *p_data) { template <class T> void CowData<T>::_copy_on_write() { - if (!_ptr) return; @@ -250,7 +239,6 @@ void CowData<T>::_copy_on_write() { template <class T> Error CowData<T>::resize(int p_size) { - ERR_FAIL_COND_V(p_size < 0, ERR_INVALID_PARAMETER); int current_size = size(); @@ -273,7 +261,6 @@ Error CowData<T>::resize(int p_size) { ERR_FAIL_COND_V(!_get_alloc_size_checked(p_size, &alloc_size), ERR_OUT_OF_MEMORY); if (p_size > current_size) { - if (alloc_size != current_alloc_size) { if (current_size == 0) { // alloc from scratch @@ -304,7 +291,6 @@ Error CowData<T>::resize(int p_size) { *_get_size() = p_size; } else if (p_size < current_size) { - if (!__has_trivial_destructor(T)) { // deinitialize no longer needed elements for (uint32_t i = p_size; i < *_get_size(); i++) { @@ -351,7 +337,6 @@ void CowData<T>::_ref(const CowData *p_from) { template <class T> void CowData<T>::_ref(const CowData &p_from) { - if (_ptr == p_from._ptr) return; // self assign, do nothing. @@ -368,7 +353,6 @@ void CowData<T>::_ref(const CowData &p_from) { template <class T> CowData<T>::~CowData() { - _unref(_ptr); } |