r15855: more talloc_set_destructor() typesafe fixes. nearly done ...
authorAndrew Tridgell <tridge@samba.org>
Wed, 24 May 2006 07:35:06 +0000 (07:35 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:33 +0000 (14:08 -0500)
(This used to be commit 396d82a231b6e3a91178db08b706626d4d4b420c)

13 files changed:
source4/ntvfs/posix/pvfs_search.c
source4/ntvfs/posix/pvfs_wait.c
source4/ntvfs/posix/vfs_posix.c
source4/ntvfs/sysdep/inotify.c
source4/rpc_server/dcerpc_server.c
source4/rpc_server/handles.c
source4/rpc_server/srvsvc/srvsvc_ntvfs.c
source4/smb_server/handle.c
source4/smb_server/session.c
source4/smb_server/tcon.c
source4/web_server/http.c
source4/web_server/web_server.c
source4/wrepl_server/wrepl_in_connection.c

index 32bef1ae53642b80094ef5cdf15ee8d72eea90c9..4d218fbe9c36db135febec358d3fc22d4ba82c9f 100644 (file)
@@ -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;
index 5750c0fe087a6baf49d142a946dacad0cdf4b3ae..90c9b60efe415e76c3d9a76619a95f3e5c7af9e2 100644 (file)
@@ -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);
        }
index 1682a94ac91b6996da262149e146481a2f2161e9..e7ef9bafd839f6e498f7ba12c49ab091fc02c2c7 100644 (file)
@@ -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;
 
index 33c4ff49284e755b5e438ccf9125ed433c731d83..5348006543a65523e89edfd71acba59239b5a4ea 100644 (file)
@@ -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);
index a0a014895902b6c21a0da49de9da74c9a9515bd7..fcc1989cec5f9efa9057039c9721c1a9f876c02b 100644 (file)
@@ -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;
 
index 6a7bf8831030b978c9e53b2165c8aa656d21d29f..c86550aa721bba2d3a48d7754de545a3613cb7a4 100644 (file)
@@ -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;
index 7dbaaa0f235075c2b12b5cfc1d781642a1a22c3d..9fafb8a3cdc5c798c75bd152cc51a78526df045c 100644 (file)
@@ -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;
 }
index 07b49bf79d1924cb7b9d767c635ca4007f99f897..ebeecac6033eda15b04ee44a2bb605a59ca306b4 100644 (file)
@@ -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;
index 50338ba16e639e0a00fb095523af58b9816bc561..06c4f62904b52955088799dc20d1573ad73bda12 100644 (file)
@@ -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);
index ad68ddb83604aacd37f6ccec2641594c4fa3873d..026a03bf53a4f0996ffc9ccfa76482e8a9e83230 100644 (file)
@@ -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));
index f79bedb2de493a3e5e918ce4d131ccb16598abca..8dd594de20c01ea24749e725bbba9cd8505924b6 100644 (file)
@@ -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;
 }
index 93d59cc47a19dff9de830fd427f1d1e1fa51c699..7596ca40fccdd5a4dfcd3ae2c06f3b2b67ef1602 100644 (file)
@@ -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);
        }
index dabb5500480abd151204607a2ee14a280b5b2bc0..fc44b8912c5106c6b70a4435a85bcaf1a381e290 100644 (file)
@@ -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;
 }