From 73b377432c5efb8451f09f6d25d8aa1b28c239c9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:10:15 +1000 Subject: s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc() Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett --- source3/smbd/dmapi.c | 2 +- source3/smbd/ipc.c | 2 +- source3/smbd/message.c | 2 +- source3/smbd/negprot.c | 2 +- source3/smbd/notify.c | 2 +- source3/smbd/process.c | 8 ++++---- source3/smbd/session.c | 2 +- source3/smbd/srvstr.c | 2 +- source3/smbd/trans2.c | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/dmapi.c b/source3/smbd/dmapi.c index 28440783ab..8e80a588c5 100644 --- a/source3/smbd/dmapi.c +++ b/source3/smbd/dmapi.c @@ -96,7 +96,7 @@ static int dmapi_init_session(struct smbd_dmapi_context *ctx) do { dm_sessid_t *new_sessions; nsessions *= 2; - new_sessions = TALLOC_REALLOC_ARRAY(tmp_ctx, sessions, + new_sessions = talloc_realloc(tmp_ctx, sessions, dm_sessid_t, nsessions); if (new_sessions == NULL) { talloc_free(tmp_ctx); diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 0b12179adc..aee6f58fff 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -298,7 +298,7 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq) goto send; } - state->data = TALLOC_REALLOC_ARRAY(state, state->data, uint8_t, + state->data = talloc_realloc(state, state->data, uint8_t, state->max_read); if (state->data == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/message.c b/source3/smbd/message.c index 34997a13dc..1877582d53 100644 --- a/source3/smbd/message.c +++ b/source3/smbd/message.c @@ -259,7 +259,7 @@ void reply_sendtxt(struct smb_request *req) len = MIN(SVAL(msg, 0), smbreq_bufrem(req, msg+2)); - tmp = TALLOC_REALLOC_ARRAY(smbd_msg_state, smbd_msg_state->msg, + tmp = talloc_realloc(smbd_msg_state, smbd_msg_state->msg, char, old_len + len); if (tmp == NULL) { diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index aa10563aae..da66dad0d8 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -573,7 +573,7 @@ void reply_negprot(struct smb_request *req) char **tmp; - tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), cliprotos, char *, + tmp = talloc_realloc(talloc_tos(), cliprotos, char *, num_cliprotos+1); if (tmp == NULL) { DEBUG(0, ("talloc failed\n")); diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 24385c94a0..d711cd69be 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -424,7 +424,7 @@ static void notify_fsp(files_struct *fsp, uint32 action, const char *name) return; } - if (!(changes = TALLOC_REALLOC_ARRAY( + if (!(changes = talloc_realloc( fsp->notify, fsp->notify->changes, struct notify_change, fsp->notify->num_changes+1))) { DEBUG(0, ("talloc_realloc failed\n")); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 7d9626387d..01200660fa 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1894,7 +1894,7 @@ static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command, return false; } - outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, uint8_t, new_size); + outbuf = talloc_realloc(NULL, *poutbuf, uint8_t, new_size); if (outbuf == NULL) { DEBUG(0, ("talloc failed\n")); return false; @@ -1908,7 +1908,7 @@ static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command, if (!find_andx_cmd_ofs(outbuf, &andx_cmd_ofs)) { DEBUG(1, ("invalid command chain\n")); - *poutbuf = TALLOC_REALLOC_ARRAY( + *poutbuf = talloc_realloc( NULL, *poutbuf, uint8_t, old_size); return false; } @@ -1996,7 +1996,7 @@ void chain_reply(struct smb_request *req) if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) { if (req->chain_outbuf == NULL) { - req->chain_outbuf = TALLOC_REALLOC_ARRAY( + req->chain_outbuf = talloc_realloc( req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4); if (req->chain_outbuf == NULL) { @@ -2028,7 +2028,7 @@ void chain_reply(struct smb_request *req) * over-allocated (reply_pipe_read_and_X used to be such an * example). */ - req->chain_outbuf = TALLOC_REALLOC_ARRAY( + req->chain_outbuf = talloc_realloc( req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4); if (req->chain_outbuf == NULL) { smb_panic("talloc failed"); diff --git a/source3/smbd/session.c b/source3/smbd/session.c index f3a678b205..12d4818e90 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -231,7 +231,7 @@ static int gather_sessioninfo(const char *key, struct sessionid *session, { struct session_list *sesslist = (struct session_list *)private_data; - sesslist->sessions = TALLOC_REALLOC_ARRAY( + sesslist->sessions = talloc_realloc( sesslist->mem_ctx, sesslist->sessions, struct sessionid, sesslist->count+1); diff --git a/source3/smbd/srvstr.c b/source3/smbd/srvstr.c index 050de599a5..c069dd4a5e 100644 --- a/source3/smbd/srvstr.c +++ b/source3/smbd/srvstr.c @@ -56,7 +56,7 @@ ssize_t message_push_string(uint8 **outbuf, const char *str, int flags) */ grow_size = (strlen(str) + 2) * 4; - if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, *outbuf, uint8, + if (!(tmp = talloc_realloc(NULL, *outbuf, uint8, buf_size + grow_size))) { DEBUG(0, ("talloc failed\n")); return -1; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index cc21b32fe7..72907c5d3a 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -129,7 +129,7 @@ NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, again: - val = TALLOC_REALLOC_ARRAY(mem_ctx, val, char, attr_size); + val = talloc_realloc(mem_ctx, val, char, attr_size); if (!val) { return NT_STATUS_NO_MEMORY; } @@ -200,7 +200,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, while (ea_namelist_size <= 65536) { - ea_namelist = TALLOC_REALLOC_ARRAY( + ea_namelist = talloc_realloc( names, ea_namelist, char, ea_namelist_size); if (ea_namelist == NULL) { DEBUG(0, ("talloc failed\n")); @@ -259,7 +259,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, num_names += 1; } - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, names, char *, num_names); + tmp = talloc_realloc(mem_ctx, names, char *, num_names); if (tmp == NULL) { DEBUG(0, ("talloc failed\n")); TALLOC_FREE(names); -- cgit