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/smbd/ipc.c | 2 +- source3/smbd/msdfs.c | 6 +++--- source3/smbd/open.c | 4 ++-- source3/smbd/oplock.c | 2 +- source3/smbd/process.c | 6 +++--- source3/smbd/reply.c | 6 +++--- source3/smbd/trans2.c | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index aee6f58fff..b452000e13 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -742,7 +742,7 @@ void reply_trans(struct smb_request *req) goto bad_param; } - if((state->setup = TALLOC_ARRAY( + if((state->setup = talloc_array( state, uint16, state->setup_count)) == NULL) { DEBUG(0,("reply_trans: setup malloc fail for %u " "bytes !\n", (unsigned int) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 085834b4ee..1d296e342d 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -364,7 +364,7 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx, return False; } - alt_path = TALLOC_ARRAY(ctx, char *, MAX_REFERRAL_COUNT); + alt_path = talloc_array(ctx, char *, MAX_REFERRAL_COUNT); if (!alt_path) { return False; } @@ -443,7 +443,7 @@ static bool is_msdfs_link_internal(TALLOC_CTX *ctx, if (pp_link_target) { bufsize = 1024; - link_target = TALLOC_ARRAY(ctx, char, bufsize); + link_target = talloc_array(ctx, char, bufsize); if (!link_target) { return False; } @@ -1736,7 +1736,7 @@ struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn, if (jn_count == 0) { return NULL; } - jn = TALLOC_ARRAY(ctx, struct junction_map, jn_count); + jn = talloc_array(ctx, struct junction_map, jn_count); if (!jn) { return NULL; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 06de8ab432..ee7b2ad6d2 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3124,7 +3124,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn, return NT_STATUS_OK; } - streams = TALLOC_ARRAY(talloc_tos(), files_struct *, num_streams); + streams = talloc_array(talloc_tos(), files_struct *, num_streams); if (streams == NULL) { DEBUG(0, ("talloc failed\n")); status = NT_STATUS_NO_MEMORY; @@ -3637,7 +3637,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn, * Copy in the base directory name. */ - parent_fname = TALLOC_ARRAY(talloc_tos(), char, + parent_fname = talloc_array(talloc_tos(), char, dir_name_len+2); if (parent_fname == NULL) { status = NT_STATUS_NO_MEMORY; diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 02eb3361b8..8482a00f64 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -224,7 +224,7 @@ bool should_notify_deferred_opens() static char *new_break_message_smb1(TALLOC_CTX *mem_ctx, files_struct *fsp, int cmd) { - char *result = TALLOC_ARRAY(mem_ctx, char, smb_size + 8*2 + 0); + char *result = talloc_array(mem_ctx, char, smb_size + 8*2 + 0); if (result == NULL) { DEBUG(0, ("talloc failed\n")); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 01200660fa..2b8521d54a 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -346,7 +346,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, * talloc and return. */ - *buffer = TALLOC_ARRAY(mem_ctx, char, len+4); + *buffer = talloc_array(mem_ctx, char, len+4); if (*buffer == NULL) { DEBUG(0, ("Could not allocate inbuf of length %d\n", @@ -415,7 +415,7 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, * The +4 here can't wrap, we've checked the length above already. */ - *buffer = TALLOC_ARRAY(mem_ctx, char, len+4); + *buffer = talloc_array(mem_ctx, char, len+4); if (*buffer == NULL) { DEBUG(0, ("Could not allocate inbuf of length %d\n", @@ -1356,7 +1356,7 @@ static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req, smb_panic(msg); } - *outbuf = TALLOC_ARRAY(mem_ctx, char, + *outbuf = talloc_array(mem_ctx, char, smb_size + num_words*2 + num_bytes); if (*outbuf == NULL) { return false; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 61e3a7e2d0..1980f757fd 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3094,9 +3094,9 @@ static void send_file_readbraw(connection_struct *conn, normal_readbraw: - outbuf = TALLOC_ARRAY(NULL, char, nread+4); + outbuf = talloc_array(NULL, char, nread+4); if (!outbuf) { - DEBUG(0,("send_file_readbraw: TALLOC_ARRAY failed for size %u.\n", + DEBUG(0,("send_file_readbraw: talloc_array failed for size %u.\n", (unsigned)(nread+4))); reply_readbraw_error(sconn); return; @@ -4018,7 +4018,7 @@ void reply_writebraw(struct smb_request *req) total_written = nwritten; /* Allocate a buffer of 64k + length. */ - buf = TALLOC_ARRAY(NULL, char, 65540); + buf = talloc_array(NULL, char, 65540); if (!buf) { reply_nterror(req, NT_STATUS_NO_MEMORY); error_to_writebrawerr(req); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 72907c5d3a..b9a4d4624b 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -192,7 +192,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, * TALLOC the result early to get the talloc hierarchy right. */ - names = TALLOC_ARRAY(mem_ctx, char *, 1); + names = talloc_array(mem_ctx, char *, 1); if (names == NULL) { DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; @@ -4768,7 +4768,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, case SMB_QUERY_FILE_UNIX_LINK: { int len; - char *buffer = TALLOC_ARRAY(mem_ctx, char, PATH_MAX+1); + char *buffer = talloc_array(mem_ctx, char, PATH_MAX+1); if (!buffer) { return NT_STATUS_NO_MEMORY; -- cgit