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/lib/dbwrap_file.c | 2 +- source3/lib/g_lock.c | 2 +- source3/lib/netapi/user.c | 2 +- source3/lib/sharesec.c | 2 +- source3/lib/smbldap.c | 2 +- source3/lib/system.c | 2 +- source3/lib/util_str.c | 6 +++--- source3/lib/winbind_util.c | 10 +++++----- 8 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap_file.c b/source3/lib/dbwrap_file.c index 69ad8e4b20..e195d6f6f3 100644 --- a/source3/lib/dbwrap_file.c +++ b/source3/lib/dbwrap_file.c @@ -168,7 +168,7 @@ static struct db_record *db_file_fetch_locked(struct db_context *db, if (statbuf.st_size != 0) { result->value.dsize = statbuf.st_size; - result->value.dptr = TALLOC_ARRAY(result, uint8, + result->value.dptr = talloc_array(result, uint8, statbuf.st_size); if (result->value.dptr == NULL) { DEBUG(1, ("talloc failed\n")); diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index c3d863f9a4..f2452919af 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -393,7 +393,7 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name, * sys_poll and in the clustering case we might have to add * the ctdb fd. This avoids the realloc then. */ - pollfds = TALLOC_ARRAY(talloc_tos(), struct pollfd, 2); + pollfds = talloc_array(talloc_tos(), struct pollfd, 2); if (pollfds == NULL) { status = NT_STATUS_NO_MEMORY; break; diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 28619a0e44..f1182100c7 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -3572,7 +3572,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, } sid_array.num_sids = rid_array->count + 1; - sid_array.sids = TALLOC_ARRAY(ctx, struct lsa_SidPtr, sid_array.num_sids); + sid_array.sids = talloc_array(ctx, struct lsa_SidPtr, sid_array.num_sids); if (!sid_array.sids) { werr = WERR_NOMEM; goto done; diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index c2494e2293..ed971a97a6 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -463,7 +463,7 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_d /* Add the number of ',' characters to get the number of aces. */ num_aces += count_chars(pacl,','); - ace_list = TALLOC_ARRAY(ctx, struct security_ace, num_aces); + ace_list = talloc_array(ctx, struct security_ace, num_aces); if (!ace_list) { return False; } diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index fe383663d7..1632cd2feb 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -239,7 +239,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { i++; i++; - names = TALLOC_ARRAY( mem_ctx, const char*, i ); + names = talloc_array( mem_ctx, const char*, i ); if ( !names ) { DEBUG(0,("get_attr_list: out of memory\n")); return NULL; diff --git a/source3/lib/system.c b/source3/lib/system.c index a6f7de0af5..342a5ffaed 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1382,7 +1382,7 @@ static char **extract_args(TALLOC_CTX *mem_ctx, const char *command) TALLOC_FREE(trunc_cmd); - if (!(argl = TALLOC_ARRAY(mem_ctx, char *, argcl + 1))) { + if (!(argl = talloc_array(mem_ctx, char *, argcl + 1))) { goto nomem; } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 6fe8f67448..a348b389e8 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -624,7 +624,7 @@ bool str_list_substitute(char **list, const char *pattern, const char *insert) t = *list; d = p -t; if (ld) { - t = TALLOC_ARRAY(ctx, char, ls +ld +1); + t = talloc_array(ctx, char, ls +ld +1); if (!t) { DEBUG(0,("str_list_substitute: " "Unable to allocate memory")); @@ -926,7 +926,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len, if (*bufsize == 0) *bufsize = 128; - *string = TALLOC_ARRAY(mem_ctx, char, *bufsize); + *string = talloc_array(mem_ctx, char, *bufsize); if (*string == NULL) goto error; } @@ -1229,7 +1229,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, if (!string || !*string) return NULL; - list = TALLOC_ARRAY(mem_ctx, char *, S_LIST_ABS+1); + list = talloc_array(mem_ctx, char *, S_LIST_ABS+1); if (list == NULL) { return NULL; } diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 3fa1485d45..b458ebe847 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -237,8 +237,8 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, } *domain_name = talloc_strdup(mem_ctx, dom_name); - *names = TALLOC_ARRAY(mem_ctx, const char*, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); + *names = talloc_array(mem_ctx, const char*, num_rids); + *types = talloc_array(mem_ctx, enum lsa_SidType, num_rids); for(i=0; i