1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r15855: more talloc_set_destructor() typesafe fixes. nearly done ...

(This used to be commit 396d82a231)
This commit is contained in:
Andrew Tridgell 2006-05-24 07:35:06 +00:00 committed by Gerald (Jerry) Carter
parent 971d30bb20
commit 92acfc0799
13 changed files with 15 additions and 30 deletions

View 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;

View 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);
}

View 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;

View 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);

View 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;

View 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;

View 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;
}

View 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;

View 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);

View 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));

View 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;
}

View 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);
}

View 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;
}