diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-01-21 18:54:33 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-06-13 16:09:50 +0100 |
commit | 4b43f5db7a3570978b49cb3adca3ca4afc95f8aa (patch) | |
tree | 78b1aafc50f2101507c880c090cac769ac5d9f74 /test/test-utils.c | |
parent | 93385b733927bdcfd5c6e97f9684820aa9d3d4ae (diff) | |
download | dbus-4b43f5db7a3570978b49cb3adca3ca4afc95f8aa.tar.gz |
DBusLoop: remove second layer of watch callbacks where possible
Similar to the previous commit, almost every use of DBusWatch can just
have the main loop call dbus_watch_handle.
The one exception is the bus activation code; it's had a comment
explaining why it's wrong since 2003. We should fix that one day, but for
now, just migrate it to a new _dbus_loop_add_watch_full which preserves
the second-layer callback.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
Diffstat (limited to 'test/test-utils.c')
-rw-r--r-- | test/test-utils.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/test/test-utils.c b/test/test-utils.c index f8e366b7..4fd84fe8 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -9,23 +9,12 @@ typedef struct } CData; static dbus_bool_t -connection_watch_callback (DBusWatch *watch, - unsigned int condition, - void *data) -{ - return dbus_watch_handle (watch, condition); -} - -static dbus_bool_t add_watch (DBusWatch *watch, void *data) { CData *cd = data; - return _dbus_loop_add_watch (cd->loop, - watch, - connection_watch_callback, - cd, NULL); + return _dbus_loop_add_watch (cd->loop, watch); } static void @@ -34,8 +23,7 @@ remove_watch (DBusWatch *watch, { CData *cd = data; - _dbus_loop_remove_watch (cd->loop, - watch, connection_watch_callback, cd); + _dbus_loop_remove_watch (cd->loop, watch); } static dbus_bool_t @@ -216,27 +204,12 @@ serverdata_new (DBusLoop *loop, } static dbus_bool_t -server_watch_callback (DBusWatch *watch, - unsigned int condition, - void *data) -{ - /* FIXME this can be done in dbus-mainloop.c - * if the code in activation.c for the babysitter - * watch handler is fixed. - */ - - return dbus_watch_handle (watch, condition); -} - -static dbus_bool_t add_server_watch (DBusWatch *watch, void *data) { ServerData *context = data; - return _dbus_loop_add_watch (context->loop, - watch, server_watch_callback, context, - NULL); + return _dbus_loop_add_watch (context->loop, watch); } static void @@ -245,8 +218,7 @@ remove_server_watch (DBusWatch *watch, { ServerData *context = data; - _dbus_loop_remove_watch (context->loop, - watch, server_watch_callback, context); + _dbus_loop_remove_watch (context->loop, watch); } static dbus_bool_t |