From ad0a07c531fadd1639c5298951cfaf5cfe0cb10e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:44:43 +1000 Subject: s3-talloc Change TALLOC_ZERO_P() to talloc_zero() Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc. --- source3/smbd/aio.c | 2 +- source3/smbd/conn.c | 4 ++-- source3/smbd/dir.c | 4 ++-- source3/smbd/message.c | 2 +- source3/smbd/msdfs.c | 12 ++++++------ source3/smbd/notify.c | 2 +- source3/smbd/notify_internal.c | 4 ++-- source3/smbd/ntquotas.c | 6 +++--- source3/smbd/nttrans.c | 2 +- source3/smbd/posix_acls.c | 2 +- source3/smbd/process.c | 2 +- source3/smbd/smb2_ioctl.c | 2 +- source3/smbd/trans2.c | 4 ++-- source3/smbd/vfs.c | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 1f9130fecf..db2926b4a4 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -116,7 +116,7 @@ static struct aio_extra *create_aio_extra(TALLOC_CTX *mem_ctx, files_struct *fsp, size_t buflen) { - struct aio_extra *aio_ex = TALLOC_ZERO_P(mem_ctx, struct aio_extra); + struct aio_extra *aio_ex = talloc_zero(mem_ctx, struct aio_extra); if (!aio_ex) { return NULL; diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 4e9ab91eae..a3f66b36be 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -133,7 +133,7 @@ connection_struct *conn_new(struct smbd_server_connection *sconn) if (sconn->using_smb2) { /* SMB2 */ - if (!(conn=TALLOC_ZERO_P(NULL, connection_struct)) || + if (!(conn=talloc_zero(NULL, connection_struct)) || !(conn->params = talloc(conn, struct share_params))) { DEBUG(0,("TALLOC_ZERO() failed!\n")); TALLOC_FREE(conn); @@ -188,7 +188,7 @@ find_again: return NULL; } - if (!(conn=TALLOC_ZERO_P(NULL, connection_struct)) || + if (!(conn=talloc_zero(NULL, connection_struct)) || !(conn->params = talloc(conn, struct share_params))) { DEBUG(0,("TALLOC_ZERO() failed!\n")); TALLOC_FREE(conn); diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 9969693e7b..83590ea6c0 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1342,7 +1342,7 @@ struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn, const char *mask, uint32 attr) { - struct smb_Dir *dirp = TALLOC_ZERO_P(mem_ctx, struct smb_Dir); + struct smb_Dir *dirp = talloc_zero(mem_ctx, struct smb_Dir); struct smbd_server_connection *sconn = conn->sconn; if (!dirp) { @@ -1386,7 +1386,7 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn, const char *mask, uint32 attr) { - struct smb_Dir *dirp = TALLOC_ZERO_P(mem_ctx, struct smb_Dir); + struct smb_Dir *dirp = talloc_zero(mem_ctx, struct smb_Dir); struct smbd_server_connection *sconn = conn->sconn; if (!dirp) { diff --git a/source3/smbd/message.c b/source3/smbd/message.c index 1877582d53..63b08e1262 100644 --- a/source3/smbd/message.c +++ b/source3/smbd/message.c @@ -202,7 +202,7 @@ void reply_sendstrt(struct smb_request *req) TALLOC_FREE(smbd_msg_state); - smbd_msg_state = TALLOC_ZERO_P(NULL, struct msg_state); + smbd_msg_state = talloc_zero(NULL, struct msg_state); if (smbd_msg_state == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 2ae01a95ab..af560ed19b 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -231,7 +231,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx, char *oldcwd; const char *vfs_user; - conn = TALLOC_ZERO_P(ctx, connection_struct); + conn = talloc_zero(ctx, connection_struct); if (conn == NULL) { return NT_STATUS_NO_MEMORY; } @@ -252,7 +252,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx, /* needed for smbd_vfs_init() */ - if (!(conn->params = TALLOC_ZERO_P(conn, struct share_params))) { + if (!(conn->params = talloc_zero(conn, struct share_params))) { DEBUG(0, ("TALLOC failed\n")); TALLOC_FREE(conn); return NT_STATUS_NO_MEMORY; @@ -794,7 +794,7 @@ static NTSTATUS self_ref(TALLOC_CTX *ctx, *self_referralp = True; jucn->referral_count = 1; - if((ref = TALLOC_ZERO_P(ctx, struct referral)) == NULL) { + if((ref = talloc_zero(ctx, struct referral)) == NULL) { return NT_STATUS_NO_MEMORY; } @@ -899,7 +899,7 @@ NTSTATUS get_referred_path(TALLOC_CTX *ctx, */ jucn->referral_count = 1; - if ((ref = TALLOC_ZERO_P(ctx, struct referral)) == NULL) { + if ((ref = talloc_zero(ctx, struct referral)) == NULL) { TALLOC_FREE(pdp); return NT_STATUS_NO_MEMORY; } @@ -1233,7 +1233,7 @@ int setup_dfs_referral(connection_struct *orig_conn, pathnamep++; } - junction = TALLOC_ZERO_P(ctx, struct junction_map); + junction = talloc_zero(ctx, struct junction_map); if (!junction) { *pstatus = NT_STATUS_NO_MEMORY; talloc_destroy(ctx); @@ -1630,7 +1630,7 @@ static int form_junctions(TALLOC_CTX *ctx, jucn[cnt].comment = ""; jucn[cnt].referral_count = 1; - ref = jucn[cnt].referral_list = TALLOC_ZERO_P(ctx, struct referral); + ref = jucn[cnt].referral_list = talloc_zero(ctx, struct referral); if (jucn[cnt].referral_list == NULL) { goto out; } diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index a70f86df00..8160d5ac63 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -183,7 +183,7 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter, SMB_ASSERT(fsp->notify == NULL); - if (!(fsp->notify = TALLOC_ZERO_P(NULL, struct notify_change_buf))) { + if (!(fsp->notify = talloc_zero(NULL, struct notify_change_buf))) { DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index 3098502218..3aea1625eb 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -198,7 +198,7 @@ static NTSTATUS notify_load(struct notify_context *notify, struct db_record *rec notify->seqnum = seqnum; talloc_free(notify->array); - notify->array = TALLOC_ZERO_P(notify, struct notify_array); + notify->array = talloc_zero(notify, struct notify_array); NT_STATUS_HAVE_NO_MEMORY(notify->array); if (!rec) { @@ -531,7 +531,7 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0, depth = count_chars(e.path, '/'); - listel = TALLOC_ZERO_P(notify, struct notify_list); + listel = talloc_zero(notify, struct notify_list); if (listel == NULL) { status = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/smbd/ntquotas.c b/source3/smbd/ntquotas.c index cdd08904e4..1f4fc2d0a2 100644 --- a/source3/smbd/ntquotas.c +++ b/source3/smbd/ntquotas.c @@ -201,14 +201,14 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list) DEBUG(15,("quota entry for id[%s] path[%s]\n", sid_string_dbg(&sid), fsp->conn->connectpath)); - if ((tmp_list_ent=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_LIST))==NULL) { + if ((tmp_list_ent=talloc_zero(mem_ctx,SMB_NTQUOTA_LIST))==NULL) { DEBUG(0,("TALLOC_ZERO() failed\n")); *qt_list = NULL; talloc_destroy(mem_ctx); return (-1); } - if ((tmp_list_ent->quotas=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_STRUCT))==NULL) { + if ((tmp_list_ent->quotas=talloc_zero(mem_ctx,SMB_NTQUOTA_STRUCT))==NULL) { DEBUG(0,("TALLOC_ZERO() failed\n")); *qt_list = NULL; talloc_destroy(mem_ctx); @@ -241,7 +241,7 @@ void *init_quota_handle(TALLOC_CTX *mem_ctx) if (!mem_ctx) return False; - qt_handle = TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_HANDLE); + qt_handle = talloc_zero(mem_ctx,SMB_NTQUOTA_HANDLE); if (qt_handle==NULL) { DEBUG(0,("TALLOC_ZERO() failed\n")); return NULL; diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index f0873a6b9c..5fdb07d769 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2235,7 +2235,7 @@ static void call_nt_transact_ioctl(connection_struct *conn, labels = True; } - shadow_data = TALLOC_ZERO_P(talloc_tos(), + shadow_data = talloc_zero(talloc_tos(), struct shadow_copy_data); if (shadow_data == NULL) { DEBUG(0,("TALLOC_ZERO() failed!\n")); diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index aebe64e2d8..c536306e22 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -4744,7 +4744,7 @@ struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fna struct fd_handle fh; NTSTATUS status; - conn = TALLOC_ZERO_P(ctx, connection_struct); + conn = talloc_zero(ctx, connection_struct); if (conn == NULL) { DEBUG(0, ("talloc failed\n")); return NULL; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 78beb730b9..75fa69782e 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -594,7 +594,7 @@ static bool push_queued_message(struct smb_request *req, int msg_len = smb_len(req->inbuf) + 4; struct pending_message_list *msg; - msg = TALLOC_ZERO_P(NULL, struct pending_message_list); + msg = talloc_zero(NULL, struct pending_message_list); if(msg == NULL) { DEBUG(0,("push_message: malloc fail (1)\n")); diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c index 48487428de..a5b8326626 100644 --- a/source3/smbd/smb2_ioctl.c +++ b/source3/smbd/smb2_ioctl.c @@ -411,7 +411,7 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, labels = True; } - shadow_data = TALLOC_ZERO_P(talloc_tos(), + shadow_data = talloc_zero(talloc_tos(), struct shadow_copy_data); if (tevent_req_nomem(shadow_data, req)) { DEBUG(0,("TALLOC_ZERO() failed!\n")); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 6d85edf9eb..92ac78c6e9 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -590,7 +590,7 @@ static struct ea_list *read_ea_name_list(TALLOC_CTX *ctx, const char *pdata, siz size_t converted_size, offset = 0; while (offset + 2 < data_size) { - struct ea_list *eal = TALLOC_ZERO_P(ctx, struct ea_list); + struct ea_list *eal = talloc_zero(ctx, struct ea_list); unsigned int namelen = CVAL(pdata,offset); offset++; /* Go past the namelen byte. */ @@ -628,7 +628,7 @@ static struct ea_list *read_ea_name_list(TALLOC_CTX *ctx, const char *pdata, siz struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used) { - struct ea_list *eal = TALLOC_ZERO_P(ctx, struct ea_list); + struct ea_list *eal = talloc_zero(ctx, struct ea_list); uint16 val_len; unsigned int namelen; size_t converted_size; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 8c526fa882..7be3867267 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -183,7 +183,7 @@ bool vfs_init_custom(connection_struct *conn, const char *vfs_object) DEBUGADD(5,("Successfully loaded vfs module [%s] with the new modules system\n", vfs_object)); - handle = TALLOC_ZERO_P(conn, vfs_handle_struct); + handle = talloc_zero(conn, vfs_handle_struct); if (!handle) { DEBUG(0,("TALLOC_ZERO() failed!\n")); goto fail; -- cgit