summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-08-03 16:35:17 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-08-05 10:18:33 -0400
commit93becde0ff15d0a0b01ec477e9dfe641dd9569ea (patch)
tree964eb40e1030e9efcf7664c9148ea3e568c61bca
parent4a2370f8450dafefc11f890c799660a7b99da3e7 (diff)
downloadsssd-93becde0ff15d0a0b01ec477e9dfe641dd9569ea.tar.gz
sssd-93becde0ff15d0a0b01ec477e9dfe641dd9569ea.tar.bz2
sssd-93becde0ff15d0a0b01ec477e9dfe641dd9569ea.zip
Consolidate tevent helpers
-rw-r--r--server/db/sysdb.h26
-rw-r--r--server/providers/krb5/krb5_auth.c16
-rw-r--r--server/providers/ldap/sdap_async.h17
-rw-r--r--server/resolv/async_resolv.c16
-rw-r--r--server/tests/resolv-tests.c9
-rw-r--r--server/util/util.h25
6 files changed, 25 insertions, 84 deletions
diff --git a/server/db/sysdb.h b/server/db/sysdb.h
index df2a946e..ac19dcc6 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 c2bf83ff..24250b9f 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 4012729c..1cf00d47 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 b77819c0..c269f3ec 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 4b3a19e3..7026b983 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 02916c19..82c0be22 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 */