[Bf-blender-cvs] [f526c8d303e] functions: rename Stack.empty to Stack.is_empty

Jacques Lucke noreply at git.blender.org
Sat Jan 4 16:39:12 CET 2020


Commit: f526c8d303e630f10c97b2fedb962cf0b41118fe
Author: Jacques Lucke
Date:   Sat Jan 4 14:42:39 2020 +0100
Branches: functions
https://developer.blender.org/rBf526c8d303e630f10c97b2fedb962cf0b41118fe

rename Stack.empty to Stack.is_empty

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

M	source/blender/blenlib/BLI_stack_cxx.h
M	source/blender/blenlib/intern/BLI_lazy_init.cc
M	source/blender/blenlib/intern/BLI_temporary_allocator.cc
M	source/blender/functions/intern/multi_function_network.cc
M	source/blender/functions/intern/multi_functions/network.cc
M	tests/gtests/blenlib/BLI_stack_cxx_test.cc

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

diff --git a/source/blender/blenlib/BLI_stack_cxx.h b/source/blender/blenlib/BLI_stack_cxx.h
index 1ed6a6e91dc..a26318a3dcb 100644
--- a/source/blender/blenlib/BLI_stack_cxx.h
+++ b/source/blender/blenlib/BLI_stack_cxx.h
@@ -58,7 +58,7 @@ template<typename T, uint N = 4, typename Allocator = GuardedAllocator> class St
   /**
    * Return true when the stack is empty, otherwise false.
    */
-  bool empty() const
+  bool is_empty() const
   {
     return this->size() == 0;
   }
@@ -96,7 +96,7 @@ template<typename T, uint N = 4, typename Allocator = GuardedAllocator> class St
    */
   T &peek()
   {
-    BLI_assert(!this->empty());
+    BLI_assert(!this->is_empty());
     return m_elements[this->size() - 1];
   }
 
diff --git a/source/blender/blenlib/intern/BLI_lazy_init.cc b/source/blender/blenlib/intern/BLI_lazy_init.cc
index e06290ddd01..f2f7b4ba50e 100644
--- a/source/blender/blenlib/intern/BLI_lazy_init.cc
+++ b/source/blender/blenlib/intern/BLI_lazy_init.cc
@@ -29,7 +29,7 @@ std::mutex store_free_func_mutex;
 
 void BLI_lazy_init_free_all()
 {
-  while (!free_functions.empty()) {
+  while (!free_functions.is_empty()) {
     FreeFunc free_object = free_functions.pop();
     free_object.func();
   }
diff --git a/source/blender/blenlib/intern/BLI_temporary_allocator.cc b/source/blender/blenlib/intern/BLI_temporary_allocator.cc
index 2040313fcfb..7f3a5902958 100644
--- a/source/blender/blenlib/intern/BLI_temporary_allocator.cc
+++ b/source/blender/blenlib/intern/BLI_temporary_allocator.cc
@@ -83,7 +83,7 @@ void *BLI_temporary_allocate(uint size)
 
   if (size <= SMALL_BUFFER_SIZE) {
     auto &buffers = local_storage.buffers;
-    if (buffers.empty()) {
+    if (buffers.is_empty()) {
       void *ptr = raw_allocate(SMALL_BUFFER_SIZE);
       MemHead &memhead = get_memhead(ptr);
       memhead.type = TemporaryBufferType::Small;
diff --git a/source/blender/functions/intern/multi_function_network.cc b/source/blender/functions/intern/multi_function_network.cc
index a8171bc2d3b..d28e8a4ab0b 100644
--- a/source/blender/functions/intern/multi_function_network.cc
+++ b/source/blender/functions/intern/multi_function_network.cc
@@ -332,7 +332,7 @@ Vector<const MFOutputSocket *> MFNetwork::find_dummy_dependencies(
   Set<const MFOutputSocket *> found_outputs;
   Stack<const MFInputSocket *> inputs_to_check = sockets;
 
-  while (!inputs_to_check.empty()) {
+  while (!inputs_to_check.is_empty()) {
     const MFInputSocket &input_socket = *inputs_to_check.pop();
     const MFOutputSocket &origin_socket = input_socket.origin();
 
@@ -357,7 +357,7 @@ Vector<const MFFunctionNode *> MFNetwork::find_function_dependencies(
   Set<const MFNode *> found_nodes;
   Stack<const MFInputSocket *> inputs_to_check = sockets;
 
-  while (!inputs_to_check.empty()) {
+  while (!inputs_to_check.is_empty()) {
     const MFInputSocket &input_socket = *inputs_to_check.pop();
     const MFOutputSocket &origin_socket = input_socket.origin();
     const MFNode &origin_node = origin_socket.node();
diff --git a/source/blender/functions/intern/multi_functions/network.cc b/source/blender/functions/intern/multi_functions/network.cc
index f7f5cd81542..cf5c9e9c8ef 100644
--- a/source/blender/functions/intern/multi_functions/network.cc
+++ b/source/blender/functions/intern/multi_functions/network.cc
@@ -331,7 +331,7 @@ BLI_NOINLINE void MF_EvaluateNetwork::evaluate_network_to_compute_outputs(
     sockets_to_compute.push(input_socket);
   }
 
-  while (!sockets_to_compute.empty()) {
+  while (!sockets_to_compute.is_empty()) {
     const MFSocket &socket = *sockets_to_compute.peek();
 
     if (socket.is_input()) {
diff --git a/tests/gtests/blenlib/BLI_stack_cxx_test.cc b/tests/gtests/blenlib/BLI_stack_cxx_test.cc
index 971c128d925..272bba05cb8 100644
--- a/tests/gtests/blenlib/BLI_stack_cxx_test.cc
+++ b/tests/gtests/blenlib/BLI_stack_cxx_test.cc
@@ -8,7 +8,7 @@ TEST(stack, DefaultConstructor)
 {
   IntStack stack;
   EXPECT_EQ(stack.size(), 0);
-  EXPECT_TRUE(stack.empty());
+  EXPECT_TRUE(stack.is_empty());
 }
 
 TEST(stack, ArrayRefConstructor)
@@ -19,7 +19,7 @@ TEST(stack, ArrayRefConstructor)
   EXPECT_EQ(stack.pop(), 2);
   EXPECT_EQ(stack.pop(), 7);
   EXPECT_EQ(stack.pop(), 4);
-  EXPECT_TRUE(stack.empty());
+  EXPECT_TRUE(stack.is_empty());
 }
 
 TEST(stack, Push)



More information about the Bf-blender-cvs mailing list