From 041b0767b284034aee09e9a0de2a3844b8cc546a Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 25 Nov 2002 05:13:09 +0000 Subject: 2002-11-24 Havoc Pennington * test/echo-client.c, test/echo-server.c: cheesy test clients. * configure.in (AC_CHECK_FUNCS): check for writev * dbus/dbus-message.c (_dbus_message_get_network_data): new function * dbus/dbus-list.c (_dbus_list_foreach): new function * dbus/dbus-internals.c (_dbus_verbose): new function * dbus/dbus-server.c, dbus/dbus-server.h: public object representing a server that listens for connections. * dbus/.cvsignore: create * dbus/dbus-errors.h, dbus/dbus-errors.c: public API for reporting errors * dbus/dbus-connection.h, dbus/dbus-connection.c: public object representing a connection that sends/receives messages. (Same object used for both client and server.) * dbus/dbus-transport.h, dbus/dbus-transport.c: Basic abstraction for different kinds of stream that we might read/write messages from. --- dbus/dbus-list.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'dbus/dbus-list.c') diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c index 0b8e5a4e..31e5ae3f 100644 --- a/dbus/dbus-list.c +++ b/dbus/dbus-list.c @@ -521,6 +521,34 @@ _dbus_list_get_length (DBusList **list) return length; } +/** + * Calls the given function for each element in the list. The + * function is passed the list element as its first argument, and the + * given data as its second argument. + * + * @param list address of the head of the list. + * @param function function to call for each element. + * @param data extra data for the function. + * + */ +void +_dbus_list_foreach (DBusList **list, + DBusForeachFunction function, + void *data) +{ + DBusList *link; + + link = *list; + while (link != NULL) + { + DBusList *next = _dbus_list_get_next_link (list, link); + + (* function) (link->data, data); + + link = next; + } +} + /** @} */ #ifdef DBUS_BUILD_TESTS -- cgit