From 971d30bb201f5c3faff5f575d26882eb79f7955a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 24 May 2006 07:34:11 +0000 Subject: r15854: more talloc_set_destructor() typesafe fixes (This used to be commit 61c6100617589ac6df4f527877241464cacbf8b3) --- source4/lib/events/events_liboop.c | 14 ++++++-------- source4/lib/events/events_standard.c | 12 ++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) (limited to 'source4/lib/events') diff --git a/source4/lib/events/events_liboop.c b/source4/lib/events/events_liboop.c index c81449e65e..53238662f0 100644 --- a/source4/lib/events/events_liboop.c +++ b/source4/lib/events/events_liboop.c @@ -35,9 +35,8 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ -static int oop_event_context_destructor(void *ptr) +static int oop_event_context_destructor(struct event_context *ev) { - struct event_context *ev = talloc_get_type(ptr, struct event_context); oop_source_sys *oop_sys = ev->additional_data; oop_sys_delete(oop_sys); @@ -91,9 +90,8 @@ static void *oop_event_fd_handler(oop_source *oop, int fd, oop_event oop_type, v /* destroy an fd_event */ -static int oop_event_fd_destructor(void *ptr) +static int oop_event_fd_destructor(struct fd_event *fde) { - struct fd_event *fde = talloc_get_type(ptr, struct fd_event); struct event_context *ev = fde->event_ctx; oop_source_sys *oop_sys = ev->additional_data; oop_source *oop = oop_sys_source(oop_sys); @@ -174,8 +172,9 @@ static void oop_event_set_fd_flags(struct fd_event *fde, uint16_t flags) fde->flags = flags; } -static int oop_event_timed_destructor(void *ptr); -static int oop_event_timed_deny_destructor(void *ptr) +static int oop_event_timed_destructor(struct timed_event *te); + +static int oop_event_timed_deny_destructor(struct timed_event *te) { return -1; } @@ -197,9 +196,8 @@ static void *oop_event_timed_handler(oop_source *oop, struct timeval t, void *pt /* destroy a timed event */ -static int oop_event_timed_destructor(void *ptr) +static int oop_event_timed_destructor(struct timed_event *te) { - struct timed_event *te = talloc_get_type(ptr, struct timed_event); struct event_context *ev = te->event_ctx; oop_source_sys *oop_sys = ev->additional_data; oop_source *oop = oop_sys_source(oop_sys); diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index ff11afe5d5..5d59f1b885 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -93,10 +93,8 @@ static uint32_t epoll_map_flags(uint16_t flags) /* free the epoll fd */ -static int epoll_ctx_destructor(void *ptr) +static int epoll_ctx_destructor(struct std_event_context *std_ev) { - struct std_event_context *std_ev = talloc_get_type(ptr, - struct std_event_context); close(std_ev->epoll_fd); std_ev->epoll_fd = -1; return 0; @@ -336,9 +334,8 @@ static void calc_maxfd(struct std_event_context *std_ev) /* destroy an fd_event */ -static int std_event_fd_destructor(void *ptr) +static int std_event_fd_destructor(struct fd_event *fde) { - struct fd_event *fde = talloc_get_type(ptr, struct fd_event); struct event_context *ev = fde->event_ctx; struct std_event_context *std_ev = talloc_get_type(ev->additional_data, struct std_event_context); @@ -420,16 +417,15 @@ static void std_event_set_fd_flags(struct fd_event *fde, uint16_t flags) /* destroy a timed event */ -static int std_event_timed_destructor(void *ptr) +static int std_event_timed_destructor(struct timed_event *te) { - struct timed_event *te = talloc_get_type(ptr, struct timed_event); struct std_event_context *std_ev = talloc_get_type(te->event_ctx->additional_data, struct std_event_context); DLIST_REMOVE(std_ev->timed_events, te); return 0; } -static int std_event_timed_deny_destructor(void *ptr) +static int std_event_timed_deny_destructor(struct timed_event *te) { return -1; } -- cgit