From aad6fa897f85486386b030847151cb09943c97c0 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 17 Jan 2005 00:16:28 +0000 Subject: 2005-01-16 Havoc Pennington * dbus/dbus-internals.c (_dbus_real_assert): print the function name the assertion failed in * dbus/dbus-internals.h (_dbus_return_if_fail) (_dbus_return_val_if_fail): assert that the name of the function containing the check doesn't start with '_', since we only want to use checks on public functions * dbus/dbus-connection.c (_dbus_connection_ref_unlocked): change checks to assertions * dbus/dbus-marshal-header.c (_dbus_header_set_field_basic): change checks to asserts for private function * dbus/dbus-message.c (_dbus_message_set_serial): checks to asserts for private function * dbus/dbus-marshal-recursive.c (skip_one_complete_type): remove broken assertion that was breaking make check (_dbus_type_reader_array_is_empty): remove this rather than fix it, was only used in assertions --- dbus/dbus-marshal-recursive.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'dbus/dbus-marshal-recursive.c') diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c index 2d4338ad..05b827a0 100644 --- a/dbus/dbus-marshal-recursive.c +++ b/dbus/dbus-marshal-recursive.c @@ -324,12 +324,19 @@ skip_one_complete_type (const DBusString *type_str, const unsigned char *p; const unsigned char *start; + _dbus_assert (type_str != NULL); + _dbus_assert (type_pos != NULL); + start = _dbus_string_get_const_data (type_str); p = start + *type_pos; + _dbus_assert (*p != DBUS_STRUCT_END_CHAR); + while (*p == DBUS_TYPE_ARRAY) ++p; + _dbus_assert (*p != DBUS_STRUCT_END_CHAR); + if (*p == DBUS_STRUCT_BEGIN_CHAR) { int depth; @@ -362,8 +369,6 @@ skip_one_complete_type (const DBusString *type_str, ++p; } - _dbus_assert (*p != DBUS_STRUCT_END_CHAR); - *type_pos = (int) (p - start); } @@ -848,17 +853,6 @@ _dbus_type_reader_get_value_pos (const DBusTypeReader *reader) return reader->value_pos; } -/** - * Checks whether an array has any elements. - * - * @param reader the reader - */ -static dbus_bool_t -_dbus_type_reader_array_is_empty (const DBusTypeReader *reader) -{ - return array_reader_get_array_len (reader) == 0; -} - /** * Get the address of the marshaled value in the data being read. The * address may not be aligned; you have to align it to the type of the @@ -3839,7 +3833,6 @@ run_test_delete_values (NodeIterationData *nid) int elem; _dbus_assert (n_elements > 0); - _dbus_assert (!_dbus_type_reader_array_is_empty (&reader)); elem = cycle; if (elem == 3 || elem >= n_elements) /* end of array */ @@ -3878,9 +3871,6 @@ run_test_delete_values (NodeIterationData *nid) while ((t = _dbus_type_reader_get_current_type (&reader)) != DBUS_TYPE_INVALID) { - if (t == DBUS_TYPE_ARRAY) - _dbus_assert (_dbus_type_reader_array_is_empty (&reader)); - _dbus_type_reader_next (&reader); } @@ -5428,8 +5418,6 @@ array_read_or_set_value (TestTypeNode *node, if (n_copies > 0) { - _dbus_assert (!_dbus_type_reader_array_is_empty (reader)); - _dbus_type_reader_recurse (reader, &sub); if (realign_root == NULL && arrays_write_fixed_in_blocks && @@ -5478,10 +5466,6 @@ array_read_or_set_value (TestTypeNode *node, } } } - else - { - _dbus_assert (_dbus_type_reader_array_is_empty (reader)); - } return TRUE; } -- cgit