[Bf-blender-cvs] [f0cb97c9a3f] functions: cleanup

Jacques Lucke noreply at git.blender.org
Sat Dec 14 17:45:07 CET 2019


Commit: f0cb97c9a3fb1af89f1088a57927201c0daf5e7a
Author: Jacques Lucke
Date:   Sat Dec 14 16:49:21 2019 +0100
Branches: functions
https://developer.blender.org/rBf0cb97c9a3fb1af89f1088a57927201c0daf5e7a

cleanup

===================================================================

M	source/blender/functions/FN_generic_vector_array.h

===================================================================

diff --git a/source/blender/functions/FN_generic_vector_array.h b/source/blender/functions/FN_generic_vector_array.h
index 44cd82e8af5..497ce076046 100644
--- a/source/blender/functions/FN_generic_vector_array.h
+++ b/source/blender/functions/FN_generic_vector_array.h
@@ -81,11 +81,12 @@ class GenericVectorArray : BLI::NonCopyable, BLI::NonMovable {
 
   void append_single__copy(uint index, const void *src)
   {
-    if (m_lengths[index] == m_capacities[index]) {
-      this->grow_single(index, m_lengths[index] + 1);
+    uint old_length = m_lengths[index];
+    if (old_length == m_capacities[index]) {
+      this->grow_single(index, old_length + 1);
     }
 
-    void *dst = POINTER_OFFSET(m_starts[index], m_element_size * m_lengths[index]);
+    void *dst = POINTER_OFFSET(m_starts[index], m_element_size * old_length);
     m_type.copy_to_uninitialized(src, dst);
     m_lengths[index]++;
   }
@@ -175,7 +176,7 @@ class GenericVectorArray : BLI::NonCopyable, BLI::NonMovable {
 
     void append_single(uint index, const T &value)
     {
-      m_data->append_single__copy(index, (void *)&value);
+      m_data->append_single__copy(index, (const void *)&value);
     }
 
     void extend_single(uint index, ArrayRef<T> values)



More information about the Bf-blender-cvs mailing list