From 5e26e94092b56ee47e7ec7837f7cd0feb3fb0119 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:58:39 +1000 Subject: s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array() Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_ARRAY isn't standard talloc. --- source3/rpc_server/lsa/srv_lsa_nt.c | 16 ++++++++-------- source3/rpc_server/samr/srv_samr_nt.c | 30 +++++++++++++++--------------- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 24 ++++++++++++------------ 3 files changed, 35 insertions(+), 35 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index cb9eae297c..c6f45eaad0 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -520,7 +520,7 @@ NTSTATUS _lsa_EnumTrustDom(struct pipes_struct *p, return nt_status; } - entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo, count); + entries = talloc_zero_array(p->mem_ctx, struct lsa_DomainInfo, count); if (!entries) { return NT_STATUS_NO_MEMORY; } @@ -681,7 +681,7 @@ NTSTATUS _lsa_QueryInfoPolicy(struct pipes_struct *p, info->audit_events.auditing_mode = true; info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES; - info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx, + info->audit_events.settings = talloc_zero_array(p->mem_ctx, enum lsa_PolicyAuditPolicy, info->audit_events.count); if (!info->audit_events.settings) { @@ -1174,7 +1174,7 @@ NTSTATUS _lsa_LookupNames(struct pipes_struct *p, } if (num_entries) { - rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid, + rids = talloc_zero_array(p->mem_ctx, struct lsa_TranslatedSid, num_entries); if (!rids) { return NT_STATUS_NO_MEMORY; @@ -1316,7 +1316,7 @@ NTSTATUS _lsa_LookupNames3(struct pipes_struct *p, } if (num_entries) { - trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3, + trans_sids = talloc_zero_array(p->mem_ctx, struct lsa_TranslatedSid3, num_entries); if (!trans_sids) { return NT_STATUS_NO_MEMORY; @@ -2230,7 +2230,7 @@ NTSTATUS _lsa_EnumPrivs(struct pipes_struct *p, return NT_STATUS_ACCESS_DENIED; if (num_privs) { - entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs); + entries = talloc_zero_array(p->mem_ctx, struct lsa_PrivEntry, num_privs); if (!entries) { return NT_STATUS_NO_MEMORY; } @@ -2351,7 +2351,7 @@ NTSTATUS _lsa_EnumAccounts(struct pipes_struct *p, } if (num_entries - *r->in.resume_handle) { - sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr, + sids = talloc_zero_array(p->mem_ctx, struct lsa_SidPtr, num_entries - *r->in.resume_handle); if (!sids) { talloc_free(sid_list); @@ -3030,7 +3030,7 @@ static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx, if (num_priv) { - r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge, + r->names = talloc_zero_array(mem_ctx, struct lsa_StringLarge, num_priv); if (!r->names) { return NT_STATUS_NO_MEMORY; @@ -3323,7 +3323,7 @@ NTSTATUS _lsa_EnumTrustedDomainsEx(struct pipes_struct *p, return nt_status; } - entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TrustDomainInfoInfoEx, + entries = talloc_zero_array(p->mem_ctx, struct lsa_TrustDomainInfoInfoEx, count); if (!entries) { return NT_STATUS_NO_MEMORY; diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 9f96127c0f..e5f59e604b 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -784,7 +784,7 @@ static NTSTATUS make_user_sam_entry_list(TALLOC_CTX *ctx, return NT_STATUS_OK; } - sam = TALLOC_ZERO_ARRAY(ctx, struct samr_SamEntry, num_entries); + sam = talloc_zero_array(ctx, struct samr_SamEntry, num_entries); if (sam == NULL) { DEBUG(0, ("make_user_sam_entry_list: TALLOC_ZERO failed!\n")); return NT_STATUS_NO_MEMORY; @@ -938,7 +938,7 @@ static void make_group_sam_entry_list(TALLOC_CTX *ctx, return; } - sam = TALLOC_ZERO_ARRAY(ctx, struct samr_SamEntry, num_sam_entries); + sam = talloc_zero_array(ctx, struct samr_SamEntry, num_sam_entries); if (sam == NULL) { return; } @@ -1120,7 +1120,7 @@ static NTSTATUS init_samr_dispinfo_1(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryGeneral, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryGeneral, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1164,7 +1164,7 @@ static NTSTATUS init_samr_dispinfo_2(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFull, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryFull, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1205,7 +1205,7 @@ static NTSTATUS init_samr_dispinfo_3(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFullGroup, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryFullGroup, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1246,7 +1246,7 @@ static NTSTATUS init_samr_dispinfo_4(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryAscii, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -1282,7 +1282,7 @@ static NTSTATUS init_samr_dispinfo_5(TALLOC_CTX *ctx, r->count = num_entries; - r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries); + r->entries = talloc_zero_array(ctx, struct samr_DispEntryAscii, num_entries); if (!r->entries) { return NT_STATUS_NO_MEMORY; } @@ -2050,7 +2050,7 @@ static bool make_samr_lookup_rids(TALLOC_CTX *ctx, uint32 num_names, *lsa_name_array_p = NULL; if (num_names != 0) { - lsa_name_array = TALLOC_ZERO_ARRAY(ctx, struct lsa_String, num_names); + lsa_name_array = talloc_zero_array(ctx, struct lsa_String, num_names); if (!lsa_name_array) { return false; } @@ -2100,9 +2100,9 @@ NTSTATUS _samr_LookupRids(struct pipes_struct *p, } if (num_rids) { - names = TALLOC_ZERO_ARRAY(p->mem_ctx, const char *, num_rids); - attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, enum lsa_SidType, num_rids); - wire_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, uint32, num_rids); + names = talloc_zero_array(p->mem_ctx, const char *, num_rids); + attrs = talloc_zero_array(p->mem_ctx, enum lsa_SidType, num_rids); + wire_attrs = talloc_zero_array(p->mem_ctx, uint32, num_rids); if ((names == NULL) || (attrs == NULL) || (wire_attrs==NULL)) return NT_STATUS_NO_MEMORY; @@ -2293,7 +2293,7 @@ static NTSTATUS init_samr_parameters_string(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - r->array = TALLOC_ZERO_ARRAY(mem_ctx, uint16_t, blob->length/2); + r->array = talloc_zero_array(mem_ctx, uint16_t, blob->length/2); if (!r->array) { return NT_STATUS_NO_MEMORY; } @@ -4100,7 +4100,7 @@ NTSTATUS _samr_EnumDomains(struct pipes_struct *p, return NT_STATUS_NO_MEMORY; } - entry_array = TALLOC_ZERO_ARRAY(p->mem_ctx, + entry_array = talloc_zero_array(p->mem_ctx, struct samr_SamEntry, num_entries); if (!entry_array) { @@ -5369,7 +5369,7 @@ NTSTATUS _samr_GetMembersInAlias(struct pipes_struct *p, } if (num_sids) { - sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr, num_sids); + sids = talloc_zero_array(p->mem_ctx, struct lsa_SidPtr, num_sids); if (sids == NULL) { TALLOC_FREE(pdb_sids); return NT_STATUS_NO_MEMORY; @@ -5439,7 +5439,7 @@ NTSTATUS _samr_QueryGroupMember(struct pipes_struct *p, return status; if (num_members) { - attr=TALLOC_ZERO_ARRAY(p->mem_ctx, uint32, num_members); + attr=talloc_zero_array(p->mem_ctx, uint32, num_members); if (attr == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 7fd068f1af..dd23a090f2 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -574,7 +574,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, num_services = lp_numservices(); unbecome_root(); - allowed = TALLOC_ZERO_ARRAY(ctx, bool, num_services); + allowed = talloc_zero_array(ctx, bool, num_services); W_ERROR_HAVE_NO_MEMORY(allowed); /* Count the number of entries. */ @@ -604,7 +604,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr0); ctr.ctr0->count = alloc_entries; - ctr.ctr0->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo0, alloc_entries); + ctr.ctr0->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo0, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr0->array); for (snum = 0; snum < num_services; snum++) { @@ -621,7 +621,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1); ctr.ctr1->count = alloc_entries; - ctr.ctr1->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1, alloc_entries); + ctr.ctr1->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1->array); for (snum = 0; snum < num_services; snum++) { @@ -638,7 +638,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr2); ctr.ctr2->count = alloc_entries; - ctr.ctr2->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo2, alloc_entries); + ctr.ctr2->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo2, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr2->array); for (snum = 0; snum < num_services; snum++) { @@ -655,7 +655,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr501); ctr.ctr501->count = alloc_entries; - ctr.ctr501->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo501, alloc_entries); + ctr.ctr501->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo501, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr501->array); for (snum = 0; snum < num_services; snum++) { @@ -672,7 +672,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr502); ctr.ctr502->count = alloc_entries; - ctr.ctr502->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo502, alloc_entries); + ctr.ctr502->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo502, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr502->array); for (snum = 0; snum < num_services; snum++) { @@ -689,7 +689,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004); ctr.ctr1004->count = alloc_entries; - ctr.ctr1004->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1004, alloc_entries); + ctr.ctr1004->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1004, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004->array); for (snum = 0; snum < num_services; snum++) { @@ -706,7 +706,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005); ctr.ctr1005->count = alloc_entries; - ctr.ctr1005->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1005, alloc_entries); + ctr.ctr1005->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1005, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005->array); for (snum = 0; snum < num_services; snum++) { @@ -723,7 +723,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006); ctr.ctr1006->count = alloc_entries; - ctr.ctr1006->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1006, alloc_entries); + ctr.ctr1006->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1006, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006->array); for (snum = 0; snum < num_services; snum++) { @@ -740,7 +740,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007); ctr.ctr1007->count = alloc_entries; - ctr.ctr1007->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1007, alloc_entries); + ctr.ctr1007->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1007, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007->array); for (snum = 0; snum < num_services; snum++) { @@ -757,7 +757,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501); ctr.ctr1501->count = alloc_entries; - ctr.ctr1501->array = TALLOC_ZERO_ARRAY(ctx, struct sec_desc_buf, alloc_entries); + ctr.ctr1501->array = talloc_zero_array(ctx, struct sec_desc_buf, alloc_entries); W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501->array); for (snum = 0; snum < num_services; snum++) { @@ -2438,7 +2438,7 @@ WERROR _srvsvc_NetDiskEnum(struct pipes_struct *p, *r->out.totalentries = init_server_disk_enum(&resume); - r->out.info->disks = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetDiskInfo0, + r->out.info->disks = talloc_zero_array(ctx, struct srvsvc_NetDiskInfo0, MAX_SERVER_DISK_ENTRIES); W_ERROR_HAVE_NO_MEMORY(r->out.info->disks); -- cgit