[daemon-fix] Fixed sending daemon match rules for kdbus broadcasts
[platform/upstream/dbus.git] / dbus / dbus-mempool.c
index 33aabf9..e744585 100644 (file)
@@ -173,7 +173,7 @@ _dbus_mem_pool_new (int element_size,
   _dbus_assert ((pool->block_size %
                  pool->element_size) == 0);
 
-  VALGRIND_CREATE_MEMPOOL (pool, 0, zero_elements)
+  VALGRIND_CREATE_MEMPOOL (pool, 0, zero_elements);
 
   return pool;
 }
@@ -188,7 +188,7 @@ _dbus_mem_pool_free (DBusMemPool *pool)
 {
   DBusMemBlock *block;
 
-  VALGRIND_DESTROY_MEMPOOL (pool)
+  VALGRIND_DESTROY_MEMPOOL (pool);
 
   block = pool->blocks;
   while (block != NULL)
@@ -213,7 +213,7 @@ _dbus_mem_pool_free (DBusMemPool *pool)
 void*
 _dbus_mem_pool_alloc (DBusMemPool *pool)
 {
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
   if (_dbus_disable_mem_pools ())
     {
       DBusMemBlock *block;
@@ -241,7 +241,7 @@ _dbus_mem_pool_alloc (DBusMemPool *pool)
           pool->allocated_elements += 1;
 
           VALGRIND_MEMPOOL_ALLOC (pool, (void *) &block->elements[0],
-              pool->element_size)
+              pool->element_size);
           return (void*) &block->elements[0];
         }
       else
@@ -261,7 +261,7 @@ _dbus_mem_pool_alloc (DBusMemPool *pool)
 
           pool->free_elements = pool->free_elements->next;
 
-          VALGRIND_MEMPOOL_ALLOC (pool, element, pool->element_size)
+          VALGRIND_MEMPOOL_ALLOC (pool, element, pool->element_size);
 
           if (pool->zero_elements)
             memset (element, '\0', pool->element_size);
@@ -280,7 +280,7 @@ _dbus_mem_pool_alloc (DBusMemPool *pool)
               /* Need a new block */
               DBusMemBlock *block;
               int alloc_size;
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
               int saved_counter;
 #endif
           
@@ -294,7 +294,7 @@ _dbus_mem_pool_alloc (DBusMemPool *pool)
 
               alloc_size = sizeof (DBusMemBlock) - ELEMENT_PADDING + pool->block_size;
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
               /* We save/restore the counter, so that memory pools won't
                * cause a given function to have different number of
                * allocations on different invocations. i.e.  when testing
@@ -310,7 +310,7 @@ _dbus_mem_pool_alloc (DBusMemPool *pool)
               else
                 block = dbus_malloc (alloc_size);
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
               _dbus_set_fail_alloc_counter (saved_counter);
               _dbus_assert (saved_counter == _dbus_get_fail_alloc_counter ());
 #endif
@@ -329,7 +329,7 @@ _dbus_mem_pool_alloc (DBusMemPool *pool)
 
           pool->allocated_elements += 1;
 
-          VALGRIND_MEMPOOL_ALLOC (pool, element, pool->element_size)
+          VALGRIND_MEMPOOL_ALLOC (pool, element, pool->element_size);
           return element;
         }
     }
@@ -347,9 +347,9 @@ dbus_bool_t
 _dbus_mem_pool_dealloc (DBusMemPool *pool,
                         void        *element)
 {
-  VALGRIND_MEMPOOL_FREE (pool, element)
+  VALGRIND_MEMPOOL_FREE (pool, element);
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
   if (_dbus_disable_mem_pools ())
     {
       DBusMemBlock *block;
@@ -449,7 +449,7 @@ _dbus_mem_pool_get_stats (DBusMemPool   *pool,
 
 /** @} */
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
 #include "dbus-test.h"
 #include <stdio.h>
 #include <time.h>
@@ -459,8 +459,10 @@ time_for_size (int size)
 {
   int i;
   int j;
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   clock_t start;
   clock_t end;
+#endif
 #define FREE_ARRAY_SIZE 512
 #define N_ITERATIONS FREE_ARRAY_SIZE * 512
   void *to_free[FREE_ARRAY_SIZE];
@@ -470,8 +472,10 @@ time_for_size (int size)
   
   _dbus_verbose (" malloc\n");
   
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   start = clock ();
-  
+#endif
+
   i = 0;
   j = 0;
   while (i < N_ITERATIONS)
@@ -496,6 +500,7 @@ time_for_size (int size)
       ++i;
     }
 
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   end = clock ();
 
   _dbus_verbose ("  created/destroyed %d elements in %g seconds\n",
@@ -506,6 +511,7 @@ time_for_size (int size)
   _dbus_verbose (" mempools\n");
   
   start = clock ();
+#endif
 
   pool = _dbus_mem_pool_new (size, FALSE);
   
@@ -535,6 +541,7 @@ time_for_size (int size)
 
   _dbus_mem_pool_free (pool);
   
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   end = clock ();
 
   _dbus_verbose ("  created/destroyed %d elements in %g seconds\n",
@@ -543,6 +550,7 @@ time_for_size (int size)
   _dbus_verbose (" zeroed malloc\n");
     
   start = clock ();
+#endif
   
   i = 0;
   j = 0;
@@ -568,6 +576,7 @@ time_for_size (int size)
       ++i;
     }
 
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   end = clock ();
 
   _dbus_verbose ("  created/destroyed %d elements in %g seconds\n",
@@ -576,6 +585,7 @@ time_for_size (int size)
   _dbus_verbose (" zeroed mempools\n");
   
   start = clock ();
+#endif
 
   pool = _dbus_mem_pool_new (size, TRUE);
   
@@ -605,10 +615,12 @@ time_for_size (int size)
 
   _dbus_mem_pool_free (pool);
   
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   end = clock ();
 
   _dbus_verbose ("  created/destroyed %d elements in %g seconds\n",
                  N_ITERATIONS, (end - start) / (double) CLOCKS_PER_SEC);
+#endif
 }
 
 /**
@@ -632,4 +644,4 @@ _dbus_mem_pool_test (void)
   return TRUE;
 }
 
-#endif /* DBUS_BUILD_TESTS */
+#endif /* DBUS_ENABLE_EMBEDDED_TESTS */