From 93becde0ff15d0a0b01ec477e9dfe641dd9569ea Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 3 Aug 2009 16:35:17 +0200 Subject: Consolidate tevent helpers --- server/db/sysdb.h | 26 -------------------------- server/providers/krb5/krb5_auth.c | 16 ---------------- server/providers/ldap/sdap_async.h | 17 ----------------- server/resolv/async_resolv.c | 16 ---------------- server/tests/resolv-tests.c | 9 --------- server/util/util.h | 25 +++++++++++++++++++++++++ 6 files changed, 25 insertions(+), 84 deletions(-) diff --git a/server/db/sysdb.h b/server/db/sysdb.h index df2a946e6..ac19dcc62 100644 --- a/server/db/sysdb.h +++ b/server/db/sysdb.h @@ -489,30 +489,4 @@ struct tevent_req *sysdb_cache_password_send(TALLOC_CTX *mem_ctx, const char *password); int sysdb_cache_password_recv(struct tevent_req *req); -/* TODO: remove later - * These functions are available in the latest tevent and are the ones that - * should be used as tevent_req is rightfully opaque there */ -#ifndef tevent_req_data -#define tevent_req_data(req, type) ((type *)req->private_state) -#endif - -#ifndef tevent_req_set_callback -#define tevent_req_set_callback(req, func, data) \ - do { req->async.fn = func; req->async.private_data = data; } while(0) -#endif - -#ifndef tevent_req_callback_data -#define tevent_req_callback_data(req, type) ((type *)req->async.private_data) -#endif - -#ifndef tevent_req_notify_callback -#define tevent_req_notify_callback(req) \ - do { \ - if (req->async.fn != NULL) { \ - req->async.fn(req); \ - } \ - } while(0) -#endif - - #endif /* __SYS_DB_H__ */ diff --git a/server/providers/krb5/krb5_auth.c b/server/providers/krb5/krb5_auth.c index c2bf83ff1..24250b9ff 100644 --- a/server/providers/krb5/krb5_auth.c +++ b/server/providers/krb5/krb5_auth.c @@ -165,22 +165,6 @@ failed: return kerr; } -/* TODO: remove later - * These functions are available in the latest tevent and are the ones that - * should be used as tevent_req is rightfully opaque there */ -#ifndef tevent_req_data -#define tevent_req_data(req, type) ((type *)req->private_state) -#endif - -#ifndef tevent_req_set_callback -#define tevent_req_set_callback(req, func, data) \ - do { req->async.fn = func; req->async.private_data = data; } while(0) -#endif - -#ifndef tevent_req_callback_data -#define tevent_req_callback_data(req, type) ((type *)req->async.private_data) -#endif - static void wait_for_child_handler(struct tevent_context *ev, struct tevent_signal *sige, int signum, int count, void *__siginfo, void *pvt) diff --git a/server/providers/ldap/sdap_async.h b/server/providers/ldap/sdap_async.h index 4012729ce..1cf00d476 100644 --- a/server/providers/ldap/sdap_async.h +++ b/server/providers/ldap/sdap_async.h @@ -24,23 +24,6 @@ #include "providers/dp_backend.h" #include "providers/ldap/sdap.h" -/* TODO: remove later - * These functions are available in the latest tevent and are the ones that - * should be used as tevent_req is rightfully opaque there */ -#ifndef tevent_req_data -#define tevent_req_data(req, type) ((type *)req->private_state) -#endif - -#ifndef tevent_req_set_callback -#define tevent_req_set_callback(req, func, data) \ - do { req->async.fn = func; req->async.private_data = data; } while(0) -#endif - -#ifndef tevent_req_callback_data -#define tevent_req_callback_data(req, type) ((type *)req->async.private_data) -#endif - - struct tevent_req *sdap_connect_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct sdap_options *opts, diff --git a/server/resolv/async_resolv.c b/server/resolv/async_resolv.c index b77819c0e..c269f3ec1 100644 --- a/server/resolv/async_resolv.c +++ b/server/resolv/async_resolv.c @@ -52,22 +52,6 @@ _ares_parse_txt_reply(abuf, alen, txt_out, ntxtreply) #endif /* HAVE_ARES_PARSE_TXT */ -/* TODO: remove later - * These functions are available in the latest tevent/talloc and are the ones - * that should be used as tevent_req is rightfully opaque there */ -#ifndef tevent_req_data -#define tevent_req_data(req, type) ((type *)req->private_state) -#endif - -#ifndef tevent_req_set_callback -#define tevent_req_set_callback(req, func, data) \ - do { req->async.fn = func; req->async.private_data = data; } while(0) -#endif - -#ifndef tevent_req_callback_data -#define tevent_req_callback_data(req, type) ((type *)req->async.private_data) -#endif - struct fd_watch { struct fd_watch *prev; struct fd_watch *next; diff --git a/server/tests/resolv-tests.c b/server/tests/resolv-tests.c index 4b3a19e3d..7026b9833 100644 --- a/server/tests/resolv-tests.c +++ b/server/tests/resolv-tests.c @@ -35,15 +35,6 @@ /* Interface under test */ #include "resolv/async_resolv.h" -#ifndef tevent_req_set_callback -#define tevent_req_set_callback(req, func, data) \ - do { req->async.fn = func; req->async.private_data = data; } while(0) -#endif - -#ifndef tevent_req_callback_data -#define tevent_req_callback_data(req, type) ((type *)req->async.private_data) -#endif - int use_net_test; struct resolv_test_ctx { diff --git a/server/util/util.h b/server/util/util.h index 02916c191..82c0be226 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -78,6 +78,31 @@ void debug_fn(const char *format, ...); #define talloc_zfree(ptr) do { talloc_free(ptr); ptr = NULL; } while(0) #endif +/* TODO: remove later + * These functions are available in the latest tevent and are the ones that + * should be used as tevent_req is rightfully opaque there */ +#ifndef tevent_req_data +#define tevent_req_data(req, type) ((type *)req->private_state) +#endif + +#ifndef tevent_req_set_callback +#define tevent_req_set_callback(req, func, data) \ + do { req->async.fn = func; req->async.private_data = data; } while(0) +#endif + +#ifndef tevent_req_callback_data +#define tevent_req_callback_data(req, type) ((type *)req->async.private_data) +#endif + +#ifndef tevent_req_notify_callback +#define tevent_req_notify_callback(req) \ + do { \ + if (req->async.fn != NULL) { \ + req->async.fn(req); \ + } \ + } while(0) +#endif + #include "util/dlinklist.h" /* From debug.c */ -- cgit