From 3d15137653a7d1b593a9af2eef12f6e5b9a04c4f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:30:12 +1000 Subject: s3-talloc Change TALLOC_ARRAY() to talloc_array() Using the standard macro makes it easier to move code into common, as TALLOC_ARRAY isn't standard talloc. --- source3/winbindd/idmap.c | 2 +- source3/winbindd/idmap_adex/gc_util.c | 4 ++-- source3/winbindd/wb_lookupsids.c | 12 ++++++------ source3/winbindd/winbindd_cache.c | 18 +++++++++--------- source3/winbindd/winbindd_msrpc.c | 2 +- source3/winbindd/winbindd_rpc.c | 4 ++-- source3/winbindd/winbindd_sids_to_xids.c | 4 ++-- source3/winbindd/winbindd_wins.c | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c index 2eb655f780..6ae10115b7 100644 --- a/source3/winbindd/idmap.c +++ b/source3/winbindd/idmap.c @@ -401,7 +401,7 @@ struct idmap_domain *idmap_find_domain(const char *domname) /* * talloc context for all idmap domains */ - idmap_domains = TALLOC_ARRAY(NULL, struct idmap_domain *, 1); + idmap_domains = talloc_array(NULL, struct idmap_domain *, 1); } if (idmap_domains == NULL) { diff --git a/source3/winbindd/idmap_adex/gc_util.c b/source3/winbindd/idmap_adex/gc_util.c index e4bf8d59d7..b16aa79997 100644 --- a/source3/winbindd/idmap_adex/gc_util.c +++ b/source3/winbindd/idmap_adex/gc_util.c @@ -781,10 +781,10 @@ done: #endif if (count == 0) { - ads_tmp = TALLOC_ARRAY(NULL, ADS_STRUCT*, 1); + ads_tmp = talloc_array(NULL, ADS_STRUCT*, 1); BAIL_ON_PTR_ERROR(ads_tmp, nt_status); - msg_tmp = TALLOC_ARRAY(NULL, LDAPMessage*, 1); + msg_tmp = talloc_array(NULL, LDAPMessage*, 1); BAIL_ON_PTR_ERROR(msg_tmp, nt_status); } else { ads_tmp = talloc_realloc(*ads_list, *ads_list, ADS_STRUCT*, diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c index 46766dc7b1..4832a62f12 100644 --- a/source3/winbindd/wb_lookupsids.c +++ b/source3/winbindd/wb_lookupsids.c @@ -128,7 +128,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - state->single_sids = TALLOC_ARRAY(state, uint32_t, num_sids); + state->single_sids = talloc_array(state, uint32_t, num_sids); if (tevent_req_nomem(state->single_sids, req)) { return tevent_req_post(req, ev); } @@ -137,7 +137,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(state->res_domains, req)) { return tevent_req_post(req, ev); } - state->res_domains->domains = TALLOC_ARRAY( + state->res_domains->domains = talloc_array( state->res_domains, struct lsa_DomainInfo, num_sids); if (tevent_req_nomem(state->res_domains->domains, req)) { return tevent_req_post(req, ev); @@ -147,7 +147,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(state->res_names, req)) { return tevent_req_post(req, ev); } - state->res_names->names = TALLOC_ARRAY( + state->res_names->names = talloc_array( state->res_names, struct lsa_TranslatedName, num_sids); if (tevent_req_nomem(state->res_names->names, req)) { return tevent_req_post(req, ev); @@ -187,7 +187,7 @@ static bool wb_lookupsids_next(struct tevent_req *req, if (sid_check_is_domain(&d->sid)) { state->rids.num_rids = d->sids.num_sids; - state->rids.rids = TALLOC_ARRAY(state, uint32_t, + state->rids.rids = talloc_array(state, uint32_t, state->rids.num_rids); if (tevent_req_nomem(state->rids.rids, req)) { return false; @@ -337,13 +337,13 @@ static struct wb_lookupsids_domain *wb_lookupsids_get_domain( sid_split_rid(&domain->sid, NULL); domain->domain = wb_domain; - domain->sids.sids = TALLOC_ARRAY(domains, struct lsa_SidPtr, num_sids); + domain->sids.sids = talloc_array(domains, struct lsa_SidPtr, num_sids); if (domains->sids.sids == NULL) { goto fail; } domain->sids.num_sids = 0; - domain->sid_indexes = TALLOC_ARRAY(domains, uint32_t, num_sids); + domain->sid_indexes = talloc_array(domains, uint32_t, num_sids); if (domain->sid_indexes == NULL) { TALLOC_FREE(domain->sids.sids); goto fail; diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index e1bacedaa4..a1f5ac69b5 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -309,7 +309,7 @@ static char *centry_string(struct cache_entry *centry, TALLOC_CTX *mem_ctx) smb_panic_fn("centry_string"); } - ret = TALLOC_ARRAY(mem_ctx, char, len+1); + ret = talloc_array(mem_ctx, char, len+1); if (!ret) { smb_panic_fn("centry_string out of memory\n"); } @@ -339,7 +339,7 @@ static char *centry_hash16(struct cache_entry *centry, TALLOC_CTX *mem_ctx) return NULL; } - ret = TALLOC_ARRAY(mem_ctx, char, 16); + ret = talloc_array(mem_ctx, char, 16); if (!ret) { smb_panic_fn("centry_hash out of memory\n"); } @@ -1436,7 +1436,7 @@ do_fetch_cache: if (*num_entries == 0) goto do_cached; - (*info) = TALLOC_ARRAY(mem_ctx, struct wbint_userinfo, *num_entries); + (*info) = talloc_array(mem_ctx, struct wbint_userinfo, *num_entries); if (! (*info)) { smb_panic_fn("query_user_list out of memory"); } @@ -1588,7 +1588,7 @@ do_fetch_cache: if (*num_entries == 0) goto do_cached; - (*info) = TALLOC_ARRAY(mem_ctx, struct wb_acct_info, *num_entries); + (*info) = talloc_array(mem_ctx, struct wb_acct_info, *num_entries); if (! (*info)) { smb_panic_fn("enum_dom_groups out of memory"); } @@ -1683,7 +1683,7 @@ do_fetch_cache: if (*num_entries == 0) goto do_cached; - (*info) = TALLOC_ARRAY(mem_ctx, struct wb_acct_info, *num_entries); + (*info) = talloc_array(mem_ctx, struct wb_acct_info, *num_entries); if (! (*info)) { smb_panic_fn("enum_dom_groups out of memory"); } @@ -2006,8 +2006,8 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, return NT_STATUS_OK; } - *names = TALLOC_ARRAY(mem_ctx, char *, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); + *names = talloc_array(mem_ctx, char *, num_rids); + *types = talloc_array(mem_ctx, enum lsa_SidType, num_rids); if ((*names == NULL) || (*types == NULL)) { result = NT_STATUS_NO_MEMORY; @@ -4203,7 +4203,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom, if ( !set_only ) { if ( !*domains ) { - list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, 1 ); + list = talloc_array( NULL, struct winbindd_tdc_domain, 1 ); idx = 0; } else { list = talloc_realloc( *domains, *domains, @@ -4346,7 +4346,7 @@ static size_t unpack_tdc_domains( unsigned char *buf, int buflen, return 0; } - list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, num_domains ); + list = talloc_array( NULL, struct winbindd_tdc_domain, num_domains ); if ( !list ) { DEBUG(0,("unpack_tdc_domains: Failed to talloc() domain list!\n")); return 0; diff --git a/source3/winbindd/winbindd_msrpc.c b/source3/winbindd/winbindd_msrpc.c index b17cafe5d6..699320206a 100644 --- a/source3/winbindd/winbindd_msrpc.c +++ b/source3/winbindd/winbindd_msrpc.c @@ -342,7 +342,7 @@ static NTSTATUS msrpc_rids_to_names(struct winbindd_domain *domain, DEBUG(3, ("msrpc_rids_to_names: domain %s\n", domain->name )); if (num_rids) { - sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_rids); + sids = talloc_array(mem_ctx, struct dom_sid, num_rids); if (sids == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index a4e4887703..df8d7b52c2 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -404,7 +404,7 @@ NTSTATUS rpc_rids_to_names(TALLOC_CTX *mem_ctx, NTSTATUS status; if (num_rids > 0) { - sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_rids); + sids = talloc_array(mem_ctx, struct dom_sid, num_rids); if (sids == NULL) { return NT_STATUS_NO_MEMORY; } @@ -594,7 +594,7 @@ NTSTATUS rpc_lookup_usergroups(TALLOC_CTX *mem_ctx, return result; } - user_grpsids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_groups); + user_grpsids = talloc_array(mem_ctx, struct dom_sid, num_groups); if (user_grpsids == NULL) { status = NT_STATUS_NO_MEMORY; return status; diff --git a/source3/winbindd/winbindd_sids_to_xids.c b/source3/winbindd/winbindd_sids_to_xids.c index 68616fa5b8..203ccfce09 100644 --- a/source3/winbindd/winbindd_sids_to_xids.c +++ b/source3/winbindd/winbindd_sids_to_xids.c @@ -85,7 +85,7 @@ struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(state->cached, req)) { return tevent_req_post(req, ev); } - state->non_cached = TALLOC_ARRAY(state, struct dom_sid, + state->non_cached = talloc_array(state, struct dom_sid, state->num_sids); if (tevent_req_nomem(state->non_cached, req)) { return tevent_req_post(req, ev); @@ -176,7 +176,7 @@ static void winbindd_sids_to_xids_lookupsids_done(struct tevent_req *subreq) } state->ids.num_ids = state->num_non_cached; - state->ids.ids = TALLOC_ARRAY(state, struct wbint_TransID, + state->ids.ids = talloc_array(state, struct wbint_TransID, state->num_non_cached); if (tevent_req_nomem(state->ids.ids, req)) { return; diff --git a/source3/winbindd/winbindd_wins.c b/source3/winbindd/winbindd_wins.c index a468b0f8b3..7ed330f81b 100644 --- a/source3/winbindd/winbindd_wins.c +++ b/source3/winbindd/winbindd_wins.c @@ -42,7 +42,7 @@ static struct sockaddr_storage *lookup_byname_backend(TALLOC_CTX *mem_ctx, if (NT_STATUS_IS_OK(resolve_wins(name,0x20,&ret,count))) { if ( *count == 0 ) return NULL; - return_ss = TALLOC_ARRAY(mem_ctx, struct sockaddr_storage, + return_ss = talloc_array(mem_ctx, struct sockaddr_storage, *count); if (return_ss == NULL ) { free( ret ); -- cgit