diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-10 14:32:01 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-13 17:37:02 +0000 |
commit | 75e6fdc4e23aaf6e275848b33736d9f9f3b6796f (patch) | |
tree | c5bf2cc9acd14388b0d6b33e124a0ca6681e4baf /dbus/dbus-list.c | |
parent | e70eea571509aef68289de729d4acc2b235130fd (diff) | |
download | dbus-75e6fdc4e23aaf6e275848b33736d9f9f3b6796f.tar.gz |
_dbus_list_pop_last_link: remove, unused
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39759
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
Diffstat (limited to 'dbus/dbus-list.c')
-rw-r--r-- | dbus/dbus-list.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c index f8f1c4a7..7e11cc8d 100644 --- a/dbus/dbus-list.c +++ b/dbus/dbus-list.c @@ -673,29 +673,6 @@ _dbus_list_pop_last (DBusList **list) return data; } -#ifdef DBUS_BUILD_TESTS -/** - * Removes the last link in the list and returns it. This is a - * constant-time operation. - * - * @param list address of the list head. - * @returns the last link in the list, or #NULL for an empty list. - */ -DBusList* -_dbus_list_pop_last_link (DBusList **list) -{ - DBusList *link; - - link = _dbus_list_get_last_link (list); - if (link == NULL) - return NULL; - - _dbus_list_unlink (list, link); - - return link; -} -#endif /* DBUS_BUILD_TESTS */ - /** * Copies a list. This is a linear-time operation. If there isn't * enough memory to copy the entire list, the destination list will be @@ -1057,25 +1034,25 @@ _dbus_list_test (void) DBusList *got_link1; DBusList *got_link2; - DBusList *link1; DBusList *link2; + void *data1_indirect; void *data1; void *data2; got_link1 = _dbus_list_get_last_link (&list1); got_link2 = _dbus_list_get_first_link (&list2); - - link1 = _dbus_list_pop_last_link (&list1); + link2 = _dbus_list_pop_first_link (&list2); - _dbus_assert (got_link1 == link1); _dbus_assert (got_link2 == link2); - data1 = link1->data; + data1_indirect = got_link1->data; + /* this call makes got_link1 invalid */ + data1 = _dbus_list_pop_last (&list1); + _dbus_assert (data1 == data1_indirect); data2 = link2->data; - _dbus_list_free_link (link1); _dbus_list_free_link (link2); _dbus_assert (_DBUS_POINTER_TO_INT (data1) == i); |