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/lib/charcnv.c | 4 ++-- source3/lib/ctdb_packet.c | 4 ++-- source3/lib/events.c | 4 ++-- source3/lib/messages_local.c | 2 +- source3/lib/util.c | 2 +- source3/lib/util_str.c | 4 ++-- source3/lib/util_tdb.c | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 1e44b81af9..17e836dfe0 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -202,7 +202,7 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx, /* Have we got space to append the '\0' ? */ if (size <= dest_len) { /* No, realloc. */ - dest = TALLOC_REALLOC_ARRAY(ctx, dest, char, + dest = talloc_realloc(ctx, dest, char, dest_len+1); if (!dest) { /* talloc fail. */ @@ -449,7 +449,7 @@ static size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx, /* Have we got space to append the '\0' ? */ if (size <= dest_len) { /* No, realloc. */ - dest = TALLOC_REALLOC_ARRAY(ctx, dest, char, + dest = talloc_realloc(ctx, dest, char, dest_len+1); if (!dest) { /* talloc fail. */ diff --git a/source3/lib/ctdb_packet.c b/source3/lib/ctdb_packet.c index 03be372f19..35c76fa44f 100644 --- a/source3/lib/ctdb_packet.c +++ b/source3/lib/ctdb_packet.c @@ -82,7 +82,7 @@ NTSTATUS ctdb_packet_fd_read(struct ctdb_packet_context *ctx) return NT_STATUS_NO_MEMORY; } - if (!(in = TALLOC_REALLOC_ARRAY(ctx, ctx->in.data, uint8, new_size))) { + if (!(in = talloc_realloc(ctx, ctx->in.data, uint8, new_size))) { DEBUG(10, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } @@ -245,7 +245,7 @@ NTSTATUS ctdb_packet_send(struct ctdb_packet_context *ctx, int num_blobs, ...) return NT_STATUS_OK; } - if (!(out = TALLOC_REALLOC_ARRAY(ctx, ctx->out.data, uint8, len))) { + if (!(out = talloc_realloc(ctx, ctx->out.data, uint8, len))) { DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/lib/events.c b/source3/lib/events.c index fbe3db942b..fc7f1d493a 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -90,7 +90,7 @@ bool event_add_to_poll_args(struct tevent_context *ev, TALLOC_CTX *mem_ctx, idx_len = max_fd+1; if (talloc_array_length(state->pollfd_idx) < idx_len) { - state->pollfd_idx = TALLOC_REALLOC_ARRAY( + state->pollfd_idx = talloc_realloc( state, state->pollfd_idx, int, idx_len); if (state->pollfd_idx == NULL) { DEBUG(10, ("talloc_realloc failed\n")); @@ -107,7 +107,7 @@ bool event_add_to_poll_args(struct tevent_context *ev, TALLOC_CTX *mem_ctx, */ if (talloc_array_length(fds) < num_pollfds + num_fds + 1) { - fds = TALLOC_REALLOC_ARRAY(mem_ctx, fds, struct pollfd, + fds = talloc_realloc(mem_ctx, fds, struct pollfd, num_pollfds + num_fds + 1); if (fds == NULL) { DEBUG(10, ("talloc_realloc failed\n")); diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c index f82b107bcc..9bfe6e68e0 100644 --- a/source3/lib/messages_local.c +++ b/source3/lib/messages_local.c @@ -371,7 +371,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx, goto done; } - if (!(rec = TALLOC_REALLOC_ARRAY(talloc_tos(), msg_array->messages, + if (!(rec = talloc_realloc(talloc_tos(), msg_array->messages, struct messaging_rec, msg_array->num_messages+1))) { status = NT_STATUS_NO_MEMORY; diff --git a/source3/lib/util.c b/source3/lib/util.c index 5aad243593..b4af9fbc0e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -226,7 +226,7 @@ ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob) size_t newlen = smb_len(*outbuf) + 4 + blob.length; uint8 *tmp; - if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, *outbuf, uint8, newlen))) { + if (!(tmp = talloc_realloc(NULL, *outbuf, uint8, newlen))) { DEBUG(0, ("talloc failed\n")); return -1; } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index f039a3a522..6fe8f67448 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -948,7 +948,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len, } if (increased) { - *string = TALLOC_REALLOC_ARRAY(mem_ctx, *string, char, + *string = talloc_realloc(mem_ctx, *string, char, *bufsize); if (*string == NULL) { goto error; @@ -1253,7 +1253,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, lsize += S_LIST_ABS; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, char *, + tmp = talloc_realloc(mem_ctx, list, char *, lsize + 1); if (tmp == NULL) { DEBUG(0,("str_list_make: " diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 654a538a88..5c3dc3a07d 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -231,7 +231,7 @@ bool tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len, va_end(ap); if (mem_ctx != NULL) { - *buf = TALLOC_REALLOC_ARRAY(mem_ctx, *buf, uint8, + *buf = talloc_realloc(mem_ctx, *buf, uint8, (*len) + len1); } else { *buf = SMB_REALLOC_ARRAY(*buf, uint8, (*len) + len1); -- cgit