summaryrefslogtreecommitdiff
path: root/dbus/dbus-memory.c
diff options
context:
space:
mode:
authorChengwei Yang <chengwei.yang@intel.com>2013-06-28 16:25:54 +0800
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-06-28 12:15:53 +0100
commit4df8738794422c216b25e1bc1bbc80654c948c5d (patch)
tree31e1f5bf170fdb3b8d4dc1874beb6f2a10793e18 /dbus/dbus-memory.c
parent11c5dc126e5ad21a4a72fd15700b19dd937b053a (diff)
downloaddbus-4df8738794422c216b25e1bc1bbc80654c948c5d.tar.gz
tests to embedded tests: replaced in libdbus
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66291
Diffstat (limited to 'dbus/dbus-memory.c')
-rw-r--r--dbus/dbus-memory.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/dbus/dbus-memory.c b/dbus/dbus-memory.c
index 6cf04498..d59e8f8c 100644
--- a/dbus/dbus-memory.c
+++ b/dbus/dbus-memory.c
@@ -97,7 +97,7 @@
* @{
*/
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
static dbus_bool_t debug_initialized = FALSE;
static int fail_nth = -1;
static size_t fail_size = 0;
@@ -240,7 +240,7 @@ _dbus_get_fail_alloc_failures (void)
return n_failures_per_failure;
}
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
/**
* Called when about to alloc some memory; if
* it returns #TRUE, then the allocation should
@@ -294,7 +294,7 @@ _dbus_decrement_fail_alloc_counter (void)
return FALSE;
}
}
-#endif /* DBUS_BUILD_TESTS */
+#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
/**
* Get the number of outstanding malloc()'d blocks.
@@ -460,7 +460,7 @@ set_guards (void *real_block,
void*
dbus_malloc (size_t bytes)
{
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
_dbus_initialize_malloc_debug ();
if (_dbus_decrement_fail_alloc_counter ())
@@ -472,7 +472,7 @@ dbus_malloc (size_t bytes)
if (bytes == 0) /* some system mallocs handle this, some don't */
return NULL;
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
else if (fail_size != 0 && bytes > fail_size)
return NULL;
else if (guards)
@@ -499,7 +499,7 @@ dbus_malloc (size_t bytes)
void *mem;
mem = malloc (bytes);
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
if (mem)
{
_dbus_atomic_inc (&n_blocks_outstanding);
@@ -530,7 +530,7 @@ dbus_malloc (size_t bytes)
void*
dbus_malloc0 (size_t bytes)
{
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
_dbus_initialize_malloc_debug ();
if (_dbus_decrement_fail_alloc_counter ())
@@ -543,7 +543,7 @@ dbus_malloc0 (size_t bytes)
if (bytes == 0)
return NULL;
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
else if (fail_size != 0 && bytes > fail_size)
return NULL;
else if (guards)
@@ -571,7 +571,7 @@ dbus_malloc0 (size_t bytes)
void *mem;
mem = calloc (bytes, 1);
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
if (mem)
{
_dbus_atomic_inc (&n_blocks_outstanding);
@@ -601,7 +601,7 @@ void*
dbus_realloc (void *memory,
size_t bytes)
{
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
_dbus_initialize_malloc_debug ();
if (_dbus_decrement_fail_alloc_counter ())
@@ -617,7 +617,7 @@ dbus_realloc (void *memory,
dbus_free (memory);
return NULL;
}
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
else if (fail_size != 0 && bytes > fail_size)
return NULL;
else if (guards)
@@ -677,7 +677,7 @@ dbus_realloc (void *memory,
void *mem;
mem = realloc (memory, bytes);
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
if (mem == NULL && malloc_cannot_fail)
{
_dbus_warn ("out of memory: malloc (%ld)\n", (long) bytes);
@@ -700,7 +700,7 @@ dbus_realloc (void *memory,
void
dbus_free (void *memory)
{
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
if (guards)
{
check_guards (memory, TRUE);
@@ -724,7 +724,7 @@ dbus_free (void *memory)
if (memory) /* we guarantee it's safe to free (NULL) */
{
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#ifdef DBUS_DISABLE_ASSERT
_dbus_atomic_dec (&n_blocks_outstanding);
#else
@@ -912,7 +912,7 @@ dbus_shutdown (void)
/** @} */ /** End of public API docs block */
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#include "dbus-test.h"
/**