From 92acfc07998da1546182579ad12a063f025c9286 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 24 May 2006 07:35:06 +0000 Subject: r15855: more talloc_set_destructor() typesafe fixes. nearly done ... (This used to be commit 396d82a231b6e3a91178db08b706626d4d4b420c) --- source4/ntvfs/posix/pvfs_search.c | 3 +-- source4/ntvfs/posix/pvfs_wait.c | 3 +-- source4/ntvfs/posix/vfs_posix.c | 3 +-- source4/ntvfs/sysdep/inotify.c | 6 ++---- source4/rpc_server/dcerpc_server.c | 4 +--- source4/rpc_server/handles.c | 3 +-- source4/rpc_server/srvsvc/srvsvc_ntvfs.c | 3 +-- source4/smb_server/handle.c | 3 +-- source4/smb_server/session.c | 3 +-- source4/smb_server/tcon.c | 5 ++--- source4/web_server/http.c | 3 +-- source4/web_server/web_server.c | 3 +-- source4/wrepl_server/wrepl_in_connection.c | 3 +-- 13 files changed, 15 insertions(+), 30 deletions(-) (limited to 'source4') diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c index 32bef1ae53..4d218fbe9c 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -35,9 +35,8 @@ /* destroy an open search */ -static int pvfs_search_destructor(void *ptr) +static int pvfs_search_destructor(struct pvfs_search_state *search) { - struct pvfs_search_state *search = ptr; DLIST_REMOVE(search->pvfs->search.list, search); idr_remove(search->pvfs->search.idtree, search->handle); return 0; diff --git a/source4/ntvfs/posix/pvfs_wait.c b/source4/ntvfs/posix/pvfs_wait.c index 5750c0fe08..90c9b60efe 100644 --- a/source4/ntvfs/posix/pvfs_wait.c +++ b/source4/ntvfs/posix/pvfs_wait.c @@ -102,9 +102,8 @@ static void pvfs_wait_timeout(struct event_context *ev, /* destroy a pending wait */ -static int pvfs_wait_destructor(void *ptr) +static int pvfs_wait_destructor(struct pvfs_wait *pwait) { - struct pvfs_wait *pwait = ptr; if (pwait->msg_type != -1) { messaging_deregister(pwait->msg_ctx, pwait->msg_type, pwait); } diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 1682a94ac9..e7ef9bafd8 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -104,9 +104,8 @@ static void pvfs_setup_options(struct pvfs_state *pvfs) } } -static int pvfs_state_destructor(void *ptr) +static int pvfs_state_destructor(struct pvfs_state *pvfs) { - struct pvfs_state *pvfs = talloc_get_type(ptr, struct pvfs_state); struct pvfs_file *f, *fn; struct pvfs_search_state *s, *sn; diff --git a/source4/ntvfs/sysdep/inotify.c b/source4/ntvfs/sysdep/inotify.c index 33c4ff4928..5348006543 100644 --- a/source4/ntvfs/sysdep/inotify.c +++ b/source4/ntvfs/sysdep/inotify.c @@ -82,9 +82,8 @@ struct watch_context { /* destroy the inotify private context */ -static int inotify_destructor(void *ptr) +static int inotify_destructor(struct inotify_private *in) { - struct inotify_private *in = talloc_get_type(ptr, struct inotify_private); close(in->fd); return 0; } @@ -308,9 +307,8 @@ static uint32_t inotify_map(struct notify_entry *e) /* destroy a watch */ -static int watch_destructor(void *ptr) +static int watch_destructor(struct watch_context *w) { - struct watch_context *w = talloc_get_type(ptr, struct watch_context); struct inotify_private *in = w->in; int wd = w->wd; DLIST_REMOVE(w->in->watches, w); diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index a0a0148959..fcc1989cec 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -266,10 +266,8 @@ _PUBLIC_ NTSTATUS dcesrv_fetch_session_key(struct dcesrv_connection *p, /* destroy a link to an endpoint */ -static int dcesrv_endpoint_destructor(void *ptr) +static int dcesrv_endpoint_destructor(struct dcesrv_connection *p) { - struct dcesrv_connection *p = ptr; - while (p->contexts) { struct dcesrv_connection_context *c = p->contexts; diff --git a/source4/rpc_server/handles.c b/source4/rpc_server/handles.c index 6a7bf88310..c86550aa72 100644 --- a/source4/rpc_server/handles.c +++ b/source4/rpc_server/handles.c @@ -27,9 +27,8 @@ /* destroy a rpc handle */ -static int dcesrv_handle_destructor(void *ptr) +static int dcesrv_handle_destructor(struct dcesrv_handle *h) { - struct dcesrv_handle *h = ptr; DLIST_REMOVE(h->context->handles, h); talloc_free(h); return 0; diff --git a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c index 7dbaaa0f23..9fafb8a3cd 100644 --- a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c +++ b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c @@ -43,9 +43,8 @@ struct srvsvc_ntvfs_ctx { struct ntvfs_context *ntvfs; }; -static int srvsvc_ntvfs_ctx_destructor(void *p) +static int srvsvc_ntvfs_ctx_destructor(struct srvsvc_ntvfs_ctx *c) { - struct srvsvc_ntvfs_ctx *c = talloc_get_type(p, struct srvsvc_ntvfs_ctx); ntvfs_disconnect(c->ntvfs); return 0; } diff --git a/source4/smb_server/handle.c b/source4/smb_server/handle.c index 07b49bf79d..ebeecac603 100644 --- a/source4/smb_server/handle.c +++ b/source4/smb_server/handle.c @@ -85,9 +85,8 @@ struct smbsrv_handle *smbsrv_smb2_handle_find(struct smbsrv_tcon *smb_tcon, /* destroy a connection structure */ -static int smbsrv_handle_destructor(void *ptr) +static int smbsrv_handle_destructor(struct smbsrv_handle *handle) { - struct smbsrv_handle *handle = talloc_get_type(ptr, struct smbsrv_handle); struct smbsrv_handles_context *handles_ctx; handles_ctx = &handle->tcon->handles; diff --git a/source4/smb_server/session.c b/source4/smb_server/session.c index 50338ba16e..06c4f62904 100644 --- a/source4/smb_server/session.c +++ b/source4/smb_server/session.c @@ -122,9 +122,8 @@ NTSTATUS smbsrv_session_sesssetup_finished(struct smbsrv_session *sess, /**************************************************************************** destroy a session structure ****************************************************************************/ -static int smbsrv_session_destructor(void *p) +static int smbsrv_session_destructor(struct smbsrv_session *sess) { - struct smbsrv_session *sess = talloc_get_type(p, struct smbsrv_session); struct smbsrv_connection *smb_conn = sess->smb_conn; idr_remove(smb_conn->sessions.idtree_vuid, sess->vuid); diff --git a/source4/smb_server/tcon.c b/source4/smb_server/tcon.c index ad68ddb836..026a03bf53 100644 --- a/source4/smb_server/tcon.c +++ b/source4/smb_server/tcon.c @@ -111,13 +111,12 @@ struct smbsrv_tcon *smbsrv_smb2_tcon_find(struct smbsrv_session *smb_sess, /* destroy a connection structure */ -static int smbsrv_tcon_destructor(void *ptr) +static int smbsrv_tcon_destructor(struct smbsrv_tcon *tcon) { - struct smbsrv_tcon *tcon = talloc_get_type(ptr, struct smbsrv_tcon); struct smbsrv_tcons_context *tcons_ctx; struct socket_address *client_addr; - client_addr = socket_get_peer_addr(tcon->smb_conn->connection->socket, ptr); + client_addr = socket_get_peer_addr(tcon->smb_conn->connection->socket, tcon); DEBUG(3,("%s closed connection to service %s\n", client_addr ? client_addr->addr : "(unknown)", tcon->share_name)); diff --git a/source4/web_server/http.c b/source4/web_server/http.c index f79bedb2de..8dd594de20 100644 --- a/source4/web_server/http.c +++ b/source4/web_server/http.c @@ -668,9 +668,8 @@ static void session_timeout(struct event_context *ev, struct timed_event *te, /* destroy a session */ -static int session_destructor(void *ptr) +static int session_destructor(struct session_data *s) { - struct session_data *s = talloc_get_type(ptr, struct session_data); DLIST_REMOVE(s->edata->sessions, s); return 0; } diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c index 93d59cc47a..7596ca40fc 100644 --- a/source4/web_server/web_server.c +++ b/source4/web_server/web_server.c @@ -37,9 +37,8 @@ /* destroy a web connection */ -static int websrv_destructor(void *ptr) +static int websrv_destructor(struct websrv_context *web) { - struct websrv_context *web = talloc_get_type(ptr, struct websrv_context); if (web->output.fd != -1) { close(web->output.fd); } diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index dabb550048..fc44b8912c 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -38,9 +38,8 @@ void wreplsrv_terminate_in_connection(struct wreplsrv_in_connection *wreplconn, stream_terminate_connection(wreplconn->conn, reason); } -static int terminate_after_send_destructor(void *ptr) +static int terminate_after_send_destructor(struct wreplsrv_in_connection **tas) { - struct wreplsrv_in_connection **tas = talloc_get_type(ptr, struct wreplsrv_in_connection *); wreplsrv_terminate_in_connection(*tas, "wreplsrv_in_connection: terminate_after_send"); return 0; } -- cgit