diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-07 12:13:26 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-09 12:40:08 +0200 |
commit | 8d4a8389bb2df77ff8923dda8368aa2915652c1a (patch) | |
tree | aba02d7ca688a18a9ecfa2beccfe4e1b8d464c72 | |
parent | 5e26e94092b56ee47e7ec7837f7cd0feb3fb0119 (diff) | |
download | samba-8d4a8389bb2df77ff8923dda8368aa2915652c1a.tar.gz samba-8d4a8389bb2df77ff8923dda8368aa2915652c1a.tar.bz2 samba-8d4a8389bb2df77ff8923dda8368aa2915652c1a.zip |
s3-talloc Change TALLOC_MEMDUP() to talloc_memdup()
Using the standard macro makes it easier to move code into common, as
TALLOC_MEMDUP isn't standard talloc.
-rw-r--r-- | lib/addns/dnsrecord.c | 2 | ||||
-rw-r--r-- | source3/auth/auth_util.c | 2 | ||||
-rw-r--r-- | source3/include/smb_macros.h | 1 | ||||
-rw-r--r-- | source3/lib/ctdb_packet.c | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 2 | ||||
-rw-r--r-- | source3/lib/util_sock.c | 2 | ||||
-rw-r--r-- | source3/libads/ldap.c | 2 | ||||
-rw-r--r-- | source3/libnet/libnet_dssync_keytab.c | 2 | ||||
-rw-r--r-- | source3/libsmb/ntlmssp.c | 4 | ||||
-rw-r--r-- | source3/locking/brlock.c | 2 | ||||
-rw-r--r-- | source3/locking/locking.c | 2 | ||||
-rw-r--r-- | source3/printing/notify.c | 4 | ||||
-rw-r--r-- | source3/registry/reg_objects.c | 2 | ||||
-rw-r--r-- | source3/registry/regfio.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 2 | ||||
-rw-r--r-- | source3/smbd/process.c | 2 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 2 |
17 files changed, 18 insertions, 19 deletions
diff --git a/lib/addns/dnsrecord.c b/lib/addns/dnsrecord.c index cdbae58c90..2240d08fb9 100644 --- a/lib/addns/dnsrecord.c +++ b/lib/addns/dnsrecord.c @@ -132,7 +132,7 @@ DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host, } ip = ((const struct sockaddr_in *)pss)->sin_addr; - if (!(data = (uint8 *)TALLOC_MEMDUP(mem_ctx, (const void *)&ip.s_addr, + if (!(data = (uint8 *)talloc_memdup(mem_ctx, (const void *)&ip.s_addr, sizeof(ip.s_addr)))) { return ERROR_DNS_NO_MEMORY; } diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 25d84e9d86..b401409f6c 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -907,7 +907,7 @@ struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx, dst->utok.gid = src->utok.gid; dst->utok.ngroups = src->utok.ngroups; if (src->utok.ngroups != 0) { - dst->utok.groups = (gid_t *)TALLOC_MEMDUP( + dst->utok.groups = (gid_t *)talloc_memdup( dst, src->utok.groups, sizeof(gid_t)*dst->utok.ngroups); } else { diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index ce1bc6dafd..37ea1b4292 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -219,7 +219,6 @@ copy an IP address from one buffer to another #define SMB_XMALLOC_ARRAY(type,count) (type *)smb_xmalloc_array(sizeof(type),(count)) #define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__) -#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__) #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__) #define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__) #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__) diff --git a/source3/lib/ctdb_packet.c b/source3/lib/ctdb_packet.c index 9faf519a60..17c70ff2d6 100644 --- a/source3/lib/ctdb_packet.c +++ b/source3/lib/ctdb_packet.c @@ -153,7 +153,7 @@ bool ctdb_packet_handler(struct ctdb_packet_context *ctx, ctx->in.data = NULL; ctx->in.length = 0; } else { - buf = (uint8_t *)TALLOC_MEMDUP(ctx, ctx->in.data, length); + buf = (uint8_t *)talloc_memdup(ctx, ctx->in.data, length); if (buf == NULL) { *status = NT_STATUS_NO_MEMORY; return true; diff --git a/source3/lib/util.c b/source3/lib/util.c index b4af9fbc0e..af5f63995b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1563,7 +1563,7 @@ bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent, len = p-dir; - if (!(*parent = (char *)TALLOC_MEMDUP(mem_ctx, dir, len+1))) { + if (!(*parent = (char *)talloc_memdup(mem_ctx, dir, len+1))) { return False; } (*parent)[len] = '\0'; diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index d44adaf915..fd91fd58dc 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -257,7 +257,7 @@ ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt) * discarding elements. */ - iov_copy = (struct iovec *)TALLOC_MEMDUP( + iov_copy = (struct iovec *)talloc_memdup( talloc_tos(), orig_iov, sizeof(struct iovec) * iovcnt); if (iov_copy == NULL) { diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 005481d184..ed17ed8473 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -790,7 +790,7 @@ static struct berval *dup_berval(TALLOC_CTX *ctx, const struct berval *in_val) if (in_val->bv_len == 0) return value; value->bv_len = in_val->bv_len; - value->bv_val = (char *)TALLOC_MEMDUP(ctx, in_val->bv_val, + value->bv_val = (char *)talloc_memdup(ctx, in_val->bv_val, in_val->bv_len); return value; } diff --git a/source3/libnet/libnet_dssync_keytab.c b/source3/libnet/libnet_dssync_keytab.c index 06758b4510..763f8baf4d 100644 --- a/source3/libnet/libnet_dssync_keytab.c +++ b/source3/libnet/libnet_dssync_keytab.c @@ -387,7 +387,7 @@ static NTSTATUS parse_object(TALLOC_CTX *mem_ctx, entry = libnet_keytab_search(ctx, principal, 0, ENCTYPE_NULL, mem_ctx); if (entry) { - name = (char *)TALLOC_MEMDUP(mem_ctx, + name = (char *)talloc_memdup(mem_ctx, entry->password.data, entry->password.length); if (!name) { diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c index d000ed59c0..fe2fb663ba 100644 --- a/source3/libsmb/ntlmssp.c +++ b/source3/libsmb/ntlmssp.c @@ -117,9 +117,9 @@ NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state, const uint8_t nt_hash[16]) { ntlmssp_state->lm_hash = (uint8_t *) - TALLOC_MEMDUP(ntlmssp_state, lm_hash, 16); + talloc_memdup(ntlmssp_state, lm_hash, 16); ntlmssp_state->nt_hash = (uint8_t *) - TALLOC_MEMDUP(ntlmssp_state, nt_hash, 16); + talloc_memdup(ntlmssp_state, nt_hash, 16); if (!ntlmssp_state->lm_hash || !ntlmssp_state->nt_hash) { TALLOC_FREE(ntlmssp_state->lm_hash); TALLOC_FREE(ntlmssp_state->nt_hash); diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index f82d873364..52e23ec003 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -1521,7 +1521,7 @@ void brl_close_fnum(struct messaging_context *msg_ctx, /* Copy the current lock array. */ if (br_lck->num_locks) { - locks_copy = (struct lock_struct *)TALLOC_MEMDUP(br_lck, locks, br_lck->num_locks * sizeof(struct lock_struct)); + locks_copy = (struct lock_struct *)talloc_memdup(br_lck, locks, br_lck->num_locks * sizeof(struct lock_struct)); if (!locks_copy) { smb_panic("brl_close_fnum: talloc failed"); } diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 91dff565d3..e0a3b93ce7 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -682,7 +682,7 @@ static bool parse_share_modes(const TDB_DATA dbuf, struct share_mode_lock *lck) } lck->share_modes = (struct share_mode_entry *) - TALLOC_MEMDUP(lck, + talloc_memdup(lck, dbuf.dptr+sizeof(struct locking_data), lck->num_share_modes * sizeof(struct share_mode_entry)); diff --git a/source3/printing/notify.c b/source3/printing/notify.c index f9a2ca3b18..0295ad2f1f 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -254,9 +254,9 @@ static bool copy_notify2_msg( SPOOLSS_NOTIFY_MSG *to, SPOOLSS_NOTIFY_MSG *from ) memcpy( to, from, sizeof(SPOOLSS_NOTIFY_MSG) ); if ( from->len ) { - to->notify.data = (char *)TALLOC_MEMDUP(send_ctx, from->notify.data, from->len ); + to->notify.data = (char *)talloc_memdup(send_ctx, from->notify.data, from->len ); if ( !to->notify.data ) { - DEBUG(0,("copy_notify2_msg: TALLOC_MEMDUP() of size [%d] failed!\n", from->len )); + DEBUG(0,("copy_notify2_msg: talloc_memdup() of size [%d] failed!\n", from->len )); return False; } } diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c index 54b6fe3441..62487e1e4f 100644 --- a/source3/registry/reg_objects.c +++ b/source3/registry/reg_objects.c @@ -475,7 +475,7 @@ struct regval_blob *regval_compose(TALLOC_CTX *ctx, const char *name, fstrcpy(regval->valuename, name); regval->type = type; if (size) { - regval->data_p = (uint8_t *)TALLOC_MEMDUP(regval, data_p, size); + regval->data_p = (uint8_t *)talloc_memdup(regval, data_p, size); if (!regval->data_p) { TALLOC_FREE(regval); return NULL; diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index b698a04b6e..6d2beccfef 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -1720,7 +1720,7 @@ static bool create_vk_record(REGF_FILE *file, REGF_VK_REC *vk, if ( vk->data_size > sizeof(uint32) ) { uint32 data_size = ( (vk->data_size+sizeof(uint32)) & 0xfffffff8 ) + 8; - vk->data = (uint8 *)TALLOC_MEMDUP( file->mem_ctx, + vk->data = (uint8 *)talloc_memdup( file->mem_ctx, regval_data_p(value), vk->data_size ); if (vk->data == NULL) { diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index f397333b4e..1be5100d9e 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1125,7 +1125,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS if ( msg->len != 0 ) msg_grp->msgs[new_slot].notify.data = (char *) - TALLOC_MEMDUP( ctr->ctx, msg->notify.data, msg->len ); + talloc_memdup( ctr->ctx, msg->notify.data, msg->len ); return ctr->num_groups; } diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 75fa69782e..f3f532fbae 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -321,7 +321,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, /* Copy the header we've written. */ - *buffer = (char *)TALLOC_MEMDUP(mem_ctx, + *buffer = (char *)talloc_memdup(mem_ctx, writeX_header, sizeof(writeX_header)); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 92ac78c6e9..ae6eb59451 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5301,7 +5301,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd } /* Copy the lock range data. */ - lock_data = (char *)TALLOC_MEMDUP( + lock_data = (char *)talloc_memdup( req, pdata, total_data); if (!lock_data) { reply_nterror(req, NT_STATUS_NO_MEMORY); |