diff options
author | Simon McVittie <smcv@collabora.com> | 2017-11-14 14:17:53 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2017-11-15 12:12:15 +0000 |
commit | 3d2300efc3584d9b5aabe2b9c2130b0eedd381bc (patch) | |
tree | c093fca50866c31a30850b92cd5528be9e633887 /dbus/dbus-memory.c | |
parent | 2edee28f152be8ae0882417604f5c580c32ee1ac (diff) | |
download | dbus-3d2300efc3584d9b5aabe2b9c2130b0eedd381bc.tar.gz |
Prefer to use _dbus_test_fatal() for assertion failures in tests
This is a little more self-documenting - it justifies why it's
acceptable to fail hard on out-of-memory conditions. _dbus_test_fatal()
isn't compiled unless we are compiling embedded tests, so compiling
with embedded tests disabled provides reasonable confidence that we
aren't using _dbus_test_fatal() inappropriately.
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Diffstat (limited to 'dbus/dbus-memory.c')
-rw-r--r-- | dbus/dbus-memory.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/dbus/dbus-memory.c b/dbus/dbus-memory.c index a9c2f7a4..c4cbd315 100644 --- a/dbus/dbus-memory.c +++ b/dbus/dbus-memory.c @@ -27,6 +27,7 @@ #include "dbus-sysdeps.h" #include "dbus-list.h" #include "dbus-threads.h" +#include <dbus/dbus-test-tap.h> #include <stdlib.h> /** @@ -939,18 +940,18 @@ _dbus_memory_test (void) guards = TRUE; p = dbus_malloc (4); if (p == NULL) - _dbus_assert_not_reached ("no memory"); + _dbus_test_fatal ("no memory"); for (size = 4; size < 256; size += 4) { p = dbus_realloc (p, size); if (p == NULL) - _dbus_assert_not_reached ("no memory"); + _dbus_test_fatal ("no memory"); } for (size = 256; size != 0; size -= 4) { p = dbus_realloc (p, size); if (p == NULL) - _dbus_assert_not_reached ("no memory"); + _dbus_test_fatal ("no memory"); } dbus_free (p); guards = old_guards; |