From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/lib/data_blob.c | 2 +- source4/lib/db_wrap.c | 4 ++-- source4/lib/dcom/common/main.c | 20 +++++++++---------- source4/lib/dcom/common/tables.c | 6 +++--- source4/lib/genrand.c | 2 +- source4/lib/idtree.c | 4 ++-- source4/lib/messaging/messaging.c | 8 ++++---- source4/lib/ms_fnmatch.c | 2 +- source4/lib/netif/interface.c | 2 +- source4/lib/registry/common/reg_interface.c | 18 ++++++++--------- source4/lib/registry/common/reg_util.c | 6 +++--- source4/lib/registry/reg_backend_dir.c | 8 ++++---- source4/lib/registry/reg_backend_gconf.c | 14 +++++++------- source4/lib/registry/reg_backend_ldb.c | 30 ++++++++++++++--------------- source4/lib/registry/reg_backend_nt4.c | 6 +++--- source4/lib/registry/reg_backend_rpc.c | 24 +++++++++++------------ source4/lib/registry/reg_backend_w95.c | 12 ++++++------ source4/lib/registry/reg_samba.c | 4 ++-- source4/lib/registry/tools/regdiff.c | 8 ++++---- source4/lib/registry/tools/regshell.c | 8 ++++---- source4/lib/registry/tools/regtree.c | 4 ++-- source4/lib/socket/socket_ipv4.c | 2 +- source4/lib/socket/socket_ipv6.c | 2 +- source4/lib/socket/socket_unix.c | 2 +- source4/lib/unix_privs.c | 2 +- source4/lib/util_sock.c | 2 +- source4/lib/util_str.c | 2 +- source4/lib/util_unistr.c | 2 +- 28 files changed, 103 insertions(+), 103 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/data_blob.c b/source4/lib/data_blob.c index deb8f55fce..284db4518f 100644 --- a/source4/lib/data_blob.c +++ b/source4/lib/data_blob.c @@ -150,7 +150,7 @@ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) int i; char *hex_string; - hex_string = talloc_array_p(mem_ctx, char, (blob->length*2)+1); + hex_string = talloc_array(mem_ctx, char, (blob->length*2)+1); if (!hex_string) { return NULL; } diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c index a9ca7e3e0a..854f772717 100644 --- a/source4/lib/db_wrap.c +++ b/source4/lib/db_wrap.c @@ -80,7 +80,7 @@ struct ldb_wrap *ldb_wrap_connect(TALLOC_CTX *mem_ctx, } } - w = talloc_p(mem_ctx, struct ldb_wrap); + w = talloc(mem_ctx, struct ldb_wrap); if (w == NULL) { return NULL; } @@ -151,7 +151,7 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, } } - w = talloc_p(mem_ctx, struct tdb_wrap); + w = talloc(mem_ctx, struct tdb_wrap); if (w == NULL) { return NULL; } diff --git a/source4/lib/dcom/common/main.c b/source4/lib/dcom/common/main.c index 219c06a665..01906501f1 100644 --- a/source4/lib/dcom/common/main.c +++ b/source4/lib/dcom/common/main.c @@ -71,10 +71,10 @@ static NTSTATUS dcom_connect_host(struct dcom_context *ctx, struct dcerpc_pipe * DCERPC_IREMOTEACTIVATION_VERSION, ctx->domain, ctx->user, ctx->password); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return status; } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); ZERO_STRUCT(bd); bd.host = server; @@ -106,7 +106,7 @@ static NTSTATUS dcom_connect_host(struct dcom_context *ctx, struct dcerpc_pipe * WERROR dcom_init(struct dcom_context **ctx, const char *domain, const char *user, const char *pass) { - *ctx = talloc_p(NULL, struct dcom_context); + *ctx = talloc(NULL, struct dcom_context); (*ctx)->oxids = NULL; (*ctx)->domain = talloc_strdup(*ctx, domain); (*ctx)->user = talloc_strdup(*ctx, user); @@ -128,7 +128,7 @@ static struct dcom_object_exporter *oxid_mapping_by_oxid (struct dcom_context *c /* Add oxid mapping if we couldn't find one */ if (!m) { - m = talloc_zero_p(ctx, struct dcom_object_exporter); + m = talloc_zero(ctx, struct dcom_object_exporter); m->oxid = oxid; DLIST_ADD(ctx->oxids, m); } @@ -169,7 +169,7 @@ static WERROR dcom_create_object_remote(struct dcom_context *ctx, struct GUID *c r.in.protseq = protseq; r.in.Interfaces = num_ifaces; r.in.pIIDs = iid; - r.out.ifaces = talloc_array_p(ctx, struct pMInterfacePointer, num_ifaces); + r.out.ifaces = talloc_array(ctx, struct pMInterfacePointer, num_ifaces); r.out.pdsaOxidBindings = &dualstring; status = dcerpc_RemoteActivation(p, ctx, &r); @@ -186,7 +186,7 @@ static WERROR dcom_create_object_remote(struct dcom_context *ctx, struct GUID *c return r.out.hr; } - *ip = talloc_array_p(ctx, struct dcom_interface_p *, num_ifaces); + *ip = talloc_array(ctx, struct dcom_interface_p *, num_ifaces); for (i = 0; i < num_ifaces; i++) { results[i] = r.out.results[i]; (*ip)[i] = NULL; @@ -419,7 +419,7 @@ struct dcom_object *dcom_object_by_oid(struct dcom_object_exporter *ox, uint64_t } if (o == NULL) { - o = talloc_zero_p(ox, struct dcom_object); + o = talloc_zero(ox, struct dcom_object); o->oid = oid; DLIST_ADD(ox->objects, o); } @@ -435,7 +435,7 @@ NTSTATUS dcom_OBJREF_from_ifacep(struct dcom_context *ctx, struct OBJREF *o, str NTSTATUS dcom_ifacep_from_OBJREF(struct dcom_context *ctx, struct dcom_interface_p **_p, struct OBJREF *o) { - struct dcom_interface_p *p = talloc_p(ctx, struct dcom_interface_p); + struct dcom_interface_p *p = talloc(ctx, struct dcom_interface_p); p->ctx = ctx; p->interface = dcom_interface_by_iid(&o->iid); @@ -502,7 +502,7 @@ NTSTATUS dcom_ifacep_from_OBJREF(struct dcom_context *ctx, struct dcom_interface DEBUG(3, ("No binding data present yet, resolving OXID %llu\n", p->ox->oxid)); - m = talloc_zero_p(p->ctx, struct dcom_oxid_mapping); + m = talloc_zero(p->ctx, struct dcom_oxid_mapping); m->oxid = oxid; i = 0; @@ -551,7 +551,7 @@ uint64_t dcom_get_current_oxid(void) struct dcom_interface_p *dcom_new_local_ifacep(struct dcom_context *ctx, const struct GUID *iid, void *vtable, struct dcom_object *object) { - struct dcom_interface_p *ip = talloc_p(ctx, struct dcom_interface_p); + struct dcom_interface_p *ip = talloc(ctx, struct dcom_interface_p); const struct dcom_interface *iface = dcom_interface_by_iid(iid); if (!iface) { diff --git a/source4/lib/dcom/common/tables.c b/source4/lib/dcom/common/tables.c index 8a764d0a65..cd7e0867ee 100644 --- a/source4/lib/dcom/common/tables.c +++ b/source4/lib/dcom/common/tables.c @@ -81,9 +81,9 @@ NTSTATUS dcom_register_interface(const void *_iface) DEBUG(5, ("Adding DCOM interface %s\n", GUID_string(lcl_ctx, &iface->iid))); - talloc_destroy(lcl_ctx); + talloc_free(lcl_ctx); - l = talloc_zero_p(interfaces?interfaces:talloc_autofree_context(), + l = talloc_zero(interfaces?interfaces:talloc_autofree_context(), struct interface_list); l->interface = *iface; @@ -96,7 +96,7 @@ NTSTATUS dcom_register_interface(const void *_iface) NTSTATUS dcom_register_class(const void *_class) { const struct dcom_class *class = _class; - struct class_list *l = talloc_zero_p(classes?classes:talloc_autofree_context(), + struct class_list *l = talloc_zero(classes?classes:talloc_autofree_context(), struct class_list); l->class = *class; diff --git a/source4/lib/genrand.c b/source4/lib/genrand.c index aab42864e0..0f1d02b710 100644 --- a/source4/lib/genrand.c +++ b/source4/lib/genrand.c @@ -278,7 +278,7 @@ char *generate_random_str_list(TALLOC_CTX *mem_ctx, size_t len, const char *list size_t i; size_t list_len = strlen(list); - char *retstr = talloc_array_p(mem_ctx, char, len + 1); + char *retstr = talloc_array(mem_ctx, char, len + 1); if (!retstr) return NULL; generate_random_buffer((uint8_t *)retstr, len); diff --git a/source4/lib/idtree.c b/source4/lib/idtree.c index c4370a812d..82c1cdd42a 100644 --- a/source4/lib/idtree.c +++ b/source4/lib/idtree.c @@ -87,7 +87,7 @@ static void free_layer(struct idr_context *idp, struct idr_layer *p) static int idr_pre_get(struct idr_context *idp) { while (idp->id_free_cnt < IDR_FREE_MAX) { - struct idr_layer *new = talloc_zero_p(idp, struct idr_layer); + struct idr_layer *new = talloc_zero(idp, struct idr_layer); if(new == NULL) return (0); free_layer(idp, new); @@ -313,7 +313,7 @@ static int _idr_remove(struct idr_context *idp, int id) */ struct idr_context *idr_init(TALLOC_CTX *mem_ctx) { - return talloc_zero_p(mem_ctx, struct idr_context); + return talloc_zero(mem_ctx, struct idr_context); } /* diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index ca7682f5d2..e2e8161111 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -199,7 +199,7 @@ static void messaging_listen_handler(struct event_context *ev, struct fd_event * NTSTATUS status; struct fd_event fde2; - rec = talloc_p(msg, struct messaging_rec); + rec = talloc(msg, struct messaging_rec); if (rec == NULL) { smb_panic("Unable to allocate messaging_rec"); } @@ -232,7 +232,7 @@ void messaging_register(struct messaging_context *msg, void *private, { struct dispatch_fn *d; - d = talloc_p(msg, struct dispatch_fn); + d = talloc(msg, struct dispatch_fn); d->msg_type = msg_type; d->private = private; d->fn = fn; @@ -371,7 +371,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, servid_t server, uint32_t NTSTATUS status; struct fd_event fde; - rec = talloc_p(msg, struct messaging_rec); + rec = talloc(msg, struct messaging_rec); if (rec == NULL) { return NT_STATUS_NO_MEMORY; } @@ -460,7 +460,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, servid_t server_id NTSTATUS status; struct fd_event fde; - msg = talloc_p(mem_ctx, struct messaging_context); + msg = talloc(mem_ctx, struct messaging_context); if (msg == NULL) { return NULL; } diff --git a/source4/lib/ms_fnmatch.c b/source4/lib/ms_fnmatch.c index 386dac4ea3..c405d2ff30 100644 --- a/source4/lib/ms_fnmatch.c +++ b/source4/lib/ms_fnmatch.c @@ -198,7 +198,7 @@ int ms_fnmatch(const char *pattern, const char *string, enum protocol_types prot if (pattern[i] == '*' || pattern[i] == '<') count++; } - max_n = talloc_array_p(NULL, struct max_n, count); + max_n = talloc_array(NULL, struct max_n, count); if (!max_n) { return -1; } diff --git a/source4/lib/netif/interface.c b/source4/lib/netif/interface.c index c73a2e3d7b..9075d4f3ac 100644 --- a/source4/lib/netif/interface.c +++ b/source4/lib/netif/interface.c @@ -241,7 +241,7 @@ void load_interfaces(void) } exit: - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); } diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index 442b34bc13..8385cef108 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -44,7 +44,7 @@ NTSTATUS registry_register(const void *_hive_ops) return NT_STATUS_OBJECT_NAME_COLLISION; } - entry = talloc_p(talloc_autofree_context(), struct reg_init_function_entry); + entry = talloc(talloc_autofree_context(), struct reg_init_function_entry); entry->hive_functions = hive_ops; DLIST_ADD(backends, entry); @@ -93,8 +93,8 @@ static struct { int reg_list_predefs(TALLOC_CTX *mem_ctx, char ***predefs, uint32_t **hkeys) { int i; - *predefs = talloc_array_p(mem_ctx, char *, ARRAY_SIZE(predef_names)); - *hkeys = talloc_array_p(mem_ctx, uint32_t, ARRAY_SIZE(predef_names)); + *predefs = talloc_array(mem_ctx, char *, ARRAY_SIZE(predef_names)); + *hkeys = talloc_array(mem_ctx, uint32_t, ARRAY_SIZE(predef_names)); for (i = 0; predef_names[i].name; i++) { (*predefs)[i] = talloc_strdup(mem_ctx, predef_names[i].name); @@ -129,7 +129,7 @@ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, const char * WERROR reg_close (struct registry_context *ctx) { - talloc_destroy(ctx); + talloc_free(ctx); return WERR_OK; } @@ -165,7 +165,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *backend, const char *lo return WERR_NOT_SUPPORTED; } - rethive = talloc_p(parent_ctx, struct registry_hive); + rethive = talloc(parent_ctx, struct registry_hive); rethive->location = location?talloc_strdup(rethive, location):NULL; rethive->functions = entry->hive_functions; rethive->backend_data = NULL; @@ -277,7 +277,7 @@ WERROR reg_key_num_subkeys(struct registry_key *key, int *count) TALLOC_CTX *mem_ctx = talloc_init("num_subkeys"); for(i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(mem_ctx, key, i, &dest)); i++); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); *count = i; if(W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) error = WERR_OK; @@ -303,7 +303,7 @@ WERROR reg_key_num_values(struct registry_key *key, int *count) TALLOC_CTX *mem_ctx = talloc_init("num_subkeys"); for(i = 0; W_ERROR_IS_OK(error = key->hive->functions->get_value_by_index(mem_ctx, key, i, &dest)); i++); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); *count = i; if(W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) error = WERR_OK; @@ -490,7 +490,7 @@ WERROR reg_key_subkeysizes(struct registry_key *key, uint32 *max_subkeylen, uint i++; } while (W_ERROR_IS_OK(error)); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return WERR_OK; } @@ -517,7 +517,7 @@ WERROR reg_key_valuesizes(struct registry_key *key, uint32 *max_valnamelen, uint i++; } while (W_ERROR_IS_OK(error)); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return WERR_OK; } diff --git a/source4/lib/registry/common/reg_util.c b/source4/lib/registry/common/reg_util.c index ef46dd6174..b11b24151e 100644 --- a/source4/lib/registry/common/reg_util.c +++ b/source4/lib/registry/common/reg_util.c @@ -99,7 +99,7 @@ char *reg_val_description(TALLOC_CTX *mem_ctx, struct registry_value *val) BOOL reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, struct registry_value **value) { int i; - *value = talloc_p(mem_ctx, struct registry_value); + *value = talloc(mem_ctx, struct registry_value); (*value)->data_type = -1; /* Find the correct type */ @@ -123,7 +123,7 @@ BOOL reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *da break; case REG_DWORD: (*value)->data_len = sizeof(uint32); - (*value)->data_blk = talloc_p(mem_ctx, uint32); + (*value)->data_blk = talloc(mem_ctx, uint32); *((uint32 *)(*value)->data_blk) = strtol(data_str, NULL, 0); break; @@ -264,7 +264,7 @@ WERROR reg_key_del_abs(struct registry_context *ctx, const char *path) error = reg_key_del(parent, n); } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return error; } diff --git a/source4/lib/registry/reg_backend_dir.c b/source4/lib/registry/reg_backend_dir.c index 4af219facb..bac0f43c20 100644 --- a/source4/lib/registry/reg_backend_dir.c +++ b/source4/lib/registry/reg_backend_dir.c @@ -41,7 +41,7 @@ static WERROR reg_dir_del_key(struct registry_key *k, const char *name) if (rmdir(child) == 0) ret = WERR_OK; else ret = WERR_GENERAL_FAILURE; - talloc_destroy(child); + talloc_free(child); return ret; } @@ -67,7 +67,7 @@ static WERROR reg_dir_open_key(TALLOC_CTX *mem_ctx, struct registry_key *p, cons return WERR_BADFILE; } closedir(d); - ret = talloc_p(mem_ctx, struct registry_key); + ret = talloc(mem_ctx, struct registry_key); ret->hive = p->hive; ret->path = fullpath; ret->backend_data = unixpath; @@ -98,7 +98,7 @@ static WERROR reg_dir_key_by_index(TALLOC_CTX *mem_ctx, struct registry_key *k, if(S_ISDIR(stbuf.st_mode)) { if(i == idx) { - (*key) = talloc_p(mem_ctx, struct registry_key); + (*key) = talloc(mem_ctx, struct registry_key); (*key)->name = e->d_name; (*key)->path = NULL; (*key)->backend_data = talloc_strdup(mem_ctx, thispath); @@ -122,7 +122,7 @@ static WERROR reg_dir_open(struct registry_hive *h, struct registry_key **key) { if(!h->location) return WERR_INVALID_PARAM; - *key = talloc_p(h, struct registry_key); + *key = talloc(h, struct registry_key); (*key)->backend_data = talloc_strdup(*key, h->location); return WERR_OK; } diff --git a/source4/lib/registry/reg_backend_gconf.c b/source4/lib/registry/reg_backend_gconf.c index 47d8c760ab..a912a42e55 100644 --- a/source4/lib/registry/reg_backend_gconf.c +++ b/source4/lib/registry/reg_backend_gconf.c @@ -35,7 +35,7 @@ static WERROR reg_open_gconf_hive(struct registry_hive *h, struct registry_key * h->backend_data = (void *)gconf_client_get_default(); if(!h->backend_data) return WERR_FOOBAR; - *k = talloc_p(h, struct registry_key); + *k = talloc(h, struct registry_key); (*k)->name = talloc_strdup(*k, ""); (*k)->path = talloc_strdup(*k, ""); (*k)->backend_data = talloc_strdup(*k, "/"); @@ -57,7 +57,7 @@ static WERROR gconf_open_key (TALLOC_CTX *mem_ctx, struct registry_key *h, const return WERR_DEST_NOT_FOUND; } - ret = talloc_p(mem_ctx, struct registry_key); + ret = talloc(mem_ctx, struct registry_key); ret->backend_data = fullpath; *key = ret; @@ -83,7 +83,7 @@ static WERROR gconf_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *p, entry = cur->data; value = gconf_entry_get_value(entry); - newval = talloc_p(mem_ctx, struct registry_value); + newval = talloc(mem_ctx, struct registry_value); newval->name = talloc_strdup(mem_ctx, strrchr(gconf_entry_get_key(entry), '/')+1); if(value) { switch(value->type) { @@ -99,20 +99,20 @@ static WERROR gconf_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *p, case GCONF_VALUE_INT: newval->data_type = REG_DWORD; - newval->data_blk = talloc_p(mem_ctx, long); + newval->data_blk = talloc(mem_ctx, long); *((long *)newval->data_blk) = gconf_value_get_int(value); newval->data_len = sizeof(long); break; case GCONF_VALUE_FLOAT: - newval->data_blk = talloc_p(mem_ctx, double); + newval->data_blk = talloc(mem_ctx, double); newval->data_type = REG_BINARY; *((double *)newval->data_blk) = gconf_value_get_float(value); newval->data_len = sizeof(double); break; case GCONF_VALUE_BOOL: - newval->data_blk = talloc_p(mem_ctx, BOOL); + newval->data_blk = talloc(mem_ctx, BOOL); newval->data_type = REG_BINARY; *((BOOL *)newval->data_blk) = gconf_value_get_bool(value); newval->data_len = sizeof(BOOL); @@ -142,7 +142,7 @@ static WERROR gconf_get_subkey_by_id(TALLOC_CTX *mem_ctx, struct registry_key *p if(!cur) return WERR_NO_MORE_ITEMS; - *sub = talloc_p(mem_ctx, struct registry_key); + *sub = talloc(mem_ctx, struct registry_key); (*sub)->name = talloc_strdup(mem_ctx, strrchr((char *)cur->data, '/')+1); (*sub)->backend_data = talloc_strdup(mem_ctx, cur->data); diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c index e0d7b6e2cb..930ea9642e 100644 --- a/source4/lib/registry/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb.c @@ -52,7 +52,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, c case REG_DWORD_LE: *len = 4; - *data = talloc_p(mem_ctx, uint32); + *data = talloc(mem_ctx, uint32); SIVAL(*data, 0, strtol(val->data, NULL, 0)); break; @@ -66,7 +66,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, c static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, TALLOC_CTX *mem_ctx, const char *name, uint32 type, void *data, int len) { struct ldb_val val; - struct ldb_message *msg = talloc_zero_p(mem_ctx, struct ldb_message); + struct ldb_message *msg = talloc_zero(mem_ctx, struct ldb_message); char *type_s; ldb_msg_add_string(ctx, msg, "value", talloc_strdup(mem_ctx, name)); @@ -165,10 +165,10 @@ static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, el = ldb_msg_find_element(kd->subkeys[idx], "key"); - *subkey = talloc_p(mem_ctx, struct registry_key); + *subkey = talloc(mem_ctx, struct registry_key); talloc_set_destructor(*subkey, reg_close_ldb_key); (*subkey)->name = talloc_strdup(mem_ctx, el->values[0].data); - (*subkey)->backend_data = newkd = talloc_zero_p(*subkey, struct ldb_key_data); + (*subkey)->backend_data = newkd = talloc_zero(*subkey, struct ldb_key_data); newkd->dn = talloc_strdup(mem_ctx, kd->subkeys[idx]->dn); return WERR_OK; @@ -191,7 +191,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, i if(idx >= kd->value_count) return WERR_NO_MORE_ITEMS; - *value = talloc_p(mem_ctx, struct registry_value); + *value = talloc(mem_ctx, struct registry_value); reg_ldb_unpack_value(mem_ctx, kd->values[idx], &(*value)->name, &(*value)->data_type, &(*value)->data_blk, &(*value)->data_len); @@ -217,10 +217,10 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, struct registry_key *h, const ch return WERR_FOOBAR; } - *key = talloc_p(mem_ctx, struct registry_key); + *key = talloc(mem_ctx, struct registry_key); talloc_set_destructor(*key, reg_close_ldb_key); (*key)->name = talloc_strdup(mem_ctx, strrchr(name, '\\')?strchr(name, '\\'):name); - (*key)->backend_data = newkd = talloc_zero_p(*key, struct ldb_key_data); + (*key)->backend_data = newkd = talloc_zero(*key, struct ldb_key_data); newkd->dn = talloc_strdup(mem_ctx, msg[0]->dn); ldb_search_free(c, msg); @@ -247,11 +247,11 @@ static WERROR ldb_open_hive(struct registry_hive *hive, struct registry_key **k) ldb_set_debug_stderr(c); hive->backend_data = c; - *k = talloc_zero_p(hive, struct registry_key); + *k = talloc_zero(hive, struct registry_key); talloc_set_destructor (*k, reg_close_ldb_key); talloc_set_destructor (hive, ldb_close_hive); (*k)->name = talloc_strdup(*k, ""); - (*k)->backend_data = kd = talloc_zero_p(*k, struct ldb_key_data); + (*k)->backend_data = kd = talloc_zero(*k, struct ldb_key_data); kd->dn = talloc_strdup(*k, "hive="); @@ -277,10 +277,10 @@ static WERROR ldb_add_key (TALLOC_CTX *mem_ctx, struct registry_key *parent, con return WERR_FOOBAR; } - *newkey = talloc_zero_p(mem_ctx, struct registry_key); + *newkey = talloc_zero(mem_ctx, struct registry_key); (*newkey)->name = talloc_strdup(mem_ctx, name); - (*newkey)->backend_data = newkd = talloc_zero_p(*newkey, struct ldb_key_data); + (*newkey)->backend_data = newkd = talloc_zero(*newkey, struct ldb_key_data); newkd->dn = talloc_steal(newkd, msg->dn); return WERR_OK; @@ -294,7 +294,7 @@ static WERROR ldb_del_key (struct registry_key *key, const char *child) ret = ldb_delete(key->hive->backend_data, childdn); - talloc_destroy(childdn); + talloc_free(childdn); if (ret < 0) { DEBUG(1, ("ldb_del_key: %s\n", ldb_errstring(key->hive->backend_data))); @@ -312,7 +312,7 @@ static WERROR ldb_del_value (struct registry_key *key, const char *child) ret = ldb_delete(key->hive->backend_data, childdn); - talloc_destroy(childdn); + talloc_free(childdn); if (ret < 0) { DEBUG(1, ("ldb_del_value: %s\n", ldb_errstring(key->hive->backend_data))); @@ -339,12 +339,12 @@ static WERROR ldb_set_value (struct registry_key *parent, const char *name, uint ret = ldb_modify(ctx, msg); if (ret < 0) { DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(parent->hive->backend_data))); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return WERR_FOOBAR; } } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return WERR_OK; } diff --git a/source4/lib/registry/reg_backend_nt4.c b/source4/lib/registry/reg_backend_nt4.c index cd3be85a23..88033a8a8b 100644 --- a/source4/lib/registry/reg_backend_nt4.c +++ b/source4/lib/registry/reg_backend_nt4.c @@ -902,7 +902,7 @@ static WERROR vk_to_val(TALLOC_CTX *mem_ctx, struct registry_key *parent, VK_HDR dat_len = IVAL(&vk_hdr->dat_len,0); /* If top bit, offset contains data */ dat_off = IVAL(&vk_hdr->dat_off,0); - tmp = talloc_p(mem_ctx, struct registry_value); + tmp = talloc(mem_ctx, struct registry_value); tmp->data_type = dat_type; if (flag & FLAG_HAS_NAME) { @@ -1070,7 +1070,7 @@ static WERROR nk_to_key(TALLOC_CTX *mem_ctx, struct registry_hive *h, NK_HDR *nk return WERR_GENERAL_FAILURE; } - tmp = talloc_p(mem_ctx, struct registry_key); + tmp = talloc(mem_ctx, struct registry_key); tmp->name = talloc_strdup(mem_ctx, key_name); tmp->backend_data = nk_hdr; @@ -1574,7 +1574,7 @@ static WERROR nt_open_hive (struct registry_hive *h, struct registry_key **key) uint_t regf_id, hbin_id; HBIN_HDR *hbin_hdr; - regf = (REGF *)talloc_p(h, REGF); + regf = (REGF *)talloc(h, REGF); memset(regf, 0, sizeof(REGF)); regf->owner_sid_str = NULL; /* FIXME: Fill in */ h->backend_data = regf; diff --git a/source4/lib/registry/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc.c index c5ed9b2c88..d2809f644a 100644 --- a/source4/lib/registry/reg_backend_rpc.c +++ b/source4/lib/registry/reg_backend_rpc.c @@ -109,14 +109,14 @@ static WERROR rpc_get_predefined_key (struct registry_context *ctx, uint32 hkey_ return WERR_NO_MORE_ITEMS; } - h = talloc_p(ctx, struct registry_hive); + h = talloc(ctx, struct registry_hive); h->functions = ®_backend_rpc; h->location = NULL; h->backend_data = ctx->backend_data; - (*k) = h->root = talloc_p(h, struct registry_key); + (*k) = h->root = talloc(h, struct registry_key); (*k)->hive = h; - (*k)->backend_data = mykeydata = talloc_p(*k, struct rpc_key_data); + (*k)->backend_data = mykeydata = talloc(*k, struct rpc_key_data); mykeydata->num_values = -1; mykeydata->num_subkeys = -1; return known_hives[n].open((struct dcerpc_pipe *)ctx->backend_data, *k, &(mykeydata->pol)); @@ -135,7 +135,7 @@ static WERROR rpc_key_put_rpc_data(TALLOC_CTX *mem_ctx, struct registry_key *k) struct winreg_OpenKey r; struct rpc_key_data *mykeydata; - k->backend_data = mykeydata = talloc_p(mem_ctx, struct rpc_key_data); + k->backend_data = mykeydata = talloc(mem_ctx, struct rpc_key_data); mykeydata->num_values = -1; mykeydata->num_subkeys = -1; @@ -159,10 +159,10 @@ static WERROR rpc_open_key(TALLOC_CTX *mem_ctx, struct registry_key *h, const ch struct rpc_key_data *mykeydata; struct winreg_OpenKey r; - *key = talloc_p(mem_ctx, struct registry_key); + *key = talloc(mem_ctx, struct registry_key); (*key)->name = talloc_strdup(mem_ctx, name); - (*key)->backend_data = mykeydata = talloc_p(mem_ctx, struct rpc_key_data); + (*key)->backend_data = mykeydata = talloc(mem_ctx, struct rpc_key_data); mykeydata->num_values = -1; mykeydata->num_subkeys = -1; @@ -217,7 +217,7 @@ static WERROR rpc_get_value_by_index(TALLOC_CTX *mem_ctx, struct registry_key *p if(NT_STATUS_IS_OK(status) && W_ERROR_IS_OK(r.out.result) && r.out.length) { - *value = talloc_p(mem_ctx, struct registry_value); + *value = talloc(mem_ctx, struct registry_value); (*value)->name = talloc_strdup(mem_ctx, r.out.name_out.name); (*value)->data_type = type; (*value)->data_len = *r.out.length; @@ -266,7 +266,7 @@ static WERROR rpc_add_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, cons init_winreg_String(&r.in.class, NULL); r.in.handle = parent->backend_data; - r.out.handle = talloc_p(mem_ctx, struct policy_handle); + r.out.handle = talloc(mem_ctx, struct policy_handle); r.in.options = 0; r.in.access_mask = access_mask; r.in.sec_desc = NULL; @@ -279,7 +279,7 @@ static WERROR rpc_add_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, cons } if (W_ERROR_IS_OK(r.out.result)) { - *key = talloc_p(mem_ctx, struct registry_key); + *key = talloc(mem_ctx, struct registry_key); (*key)->name = talloc_strdup(*key, name); (*key)->backend_data = r.out.handle; } @@ -298,7 +298,7 @@ static WERROR rpc_query_key(struct registry_key *k) r.in.handle = &mykeydata->pol; status = dcerpc_winreg_QueryInfoKey((struct dcerpc_pipe *)(k->hive->backend_data), mem_ctx, &r); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("QueryInfoKey failed - %s\n", nt_errstr(status))); @@ -327,7 +327,7 @@ static WERROR rpc_del_key(struct registry_key *parent, const char *name) status = dcerpc_winreg_DeleteKey((struct dcerpc_pipe *)parent->hive->backend_data, mem_ctx, &r); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return r.out.result; } @@ -374,7 +374,7 @@ WERROR reg_open_remote (struct registry_context **ctx, const char *user, const c NTSTATUS status; struct dcerpc_pipe *p; - *ctx = talloc_p(NULL, struct registry_context); + *ctx = talloc(NULL, struct registry_context); /* Default to local smbd if no connection is specified */ if (!location) { diff --git a/source4/lib/registry/reg_backend_w95.c b/source4/lib/registry/reg_backend_w95.c index 957039dea3..ff02f4d12b 100644 --- a/source4/lib/registry/reg_backend_w95.c +++ b/source4/lib/registry/reg_backend_w95.c @@ -187,7 +187,7 @@ static WERROR w95_open_reg (struct registry_hive *h, struct registry_key **root) DWORD i; DWORD offset; - creg = talloc_p(h, CREG); + creg = talloc(h, CREG); memset(creg, 0, sizeof(CREG)); h->backend_data = creg; @@ -234,7 +234,7 @@ static WERROR w95_open_reg (struct registry_hive *h, struct registry_key **root) } #endif - creg->rgdb_keys = talloc_array_p(h, RGDB_KEY **, creg->creg_hdr->num_rgdb); + creg->rgdb_keys = talloc_array(h, RGDB_KEY **, creg->creg_hdr->num_rgdb); offset = 0; DEBUG(3, ("Reading %d rgdb entries\n", creg->creg_hdr->num_rgdb)); @@ -250,7 +250,7 @@ static WERROR w95_open_reg (struct registry_hive *h, struct registry_key **root) } - creg->rgdb_keys[i] = talloc_array_p(h, RGDB_KEY *, rgdb_hdr->max_id+1); + creg->rgdb_keys[i] = talloc_array(h, RGDB_KEY *, rgdb_hdr->max_id+1); memset(creg->rgdb_keys[i], 0, sizeof(RGDB_KEY *) * (rgdb_hdr->max_id+1)); parse_rgdb_block(creg, rgdb_hdr); @@ -259,7 +259,7 @@ static WERROR w95_open_reg (struct registry_hive *h, struct registry_key **root) } /* First element in rgkn should be root key */ - *root = talloc_p(h, struct registry_key); + *root = talloc(h, struct registry_key); (*root)->name = NULL; (*root)->backend_data = LOCN_RGKN(creg, sizeof(RGKN_HDR)); @@ -288,7 +288,7 @@ static WERROR w95_get_subkey_by_index (TALLOC_CTX *mem_ctx, struct registry_key DEBUG(0, ("Can't find %d,%d in RGDB table!\n", child->id.rgdb, child->id.id)); return WERR_FOOBAR; } - *key = talloc_p(mem_ctx, struct registry_key); + *key = talloc(mem_ctx, struct registry_key); (*key)->backend_data = child; (*key)->name = talloc_strndup(mem_ctx, (char *)rgdb_key + sizeof(RGDB_KEY), rgdb_key->name_len); return WERR_OK; @@ -331,7 +331,7 @@ static WERROR w95_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, i offset+=sizeof(RGDB_VALUE) + curval->name_len + curval->data_len; } - *value = talloc_p(mem_ctx, struct registry_value); + *value = talloc(mem_ctx, struct registry_value); (*value)->name = talloc_strndup(mem_ctx, (char *)curval+sizeof(RGDB_VALUE), curval->name_len); (*value)->data_len = curval->data_len; diff --git a/source4/lib/registry/reg_samba.c b/source4/lib/registry/reg_samba.c index 62973a14ab..a81b9e5a42 100644 --- a/source4/lib/registry/reg_samba.c +++ b/source4/lib/registry/reg_samba.c @@ -59,14 +59,14 @@ static WERROR reg_samba_get_predef (struct registry_context *ctx, uint32 hkey, s error = reg_open_hive(ctx, backend, location, NULL, k); - talloc_destroy(backend); + talloc_free(backend); return error; } WERROR reg_open_local (struct registry_context **ctx) { - *ctx = talloc_p(NULL, struct registry_context); + *ctx = talloc(NULL, struct registry_context); (*ctx)->get_predefined_key = reg_samba_get_predef; return WERR_OK; diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 8d88cafe59..ceae3a427e 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -41,7 +41,7 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey, } } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if(!W_ERROR_EQUAL(error1, WERR_NO_MORE_ITEMS)) { DEBUG(0, ("Error occured while getting subkey by index: %d\n", W_ERROR_V(error1))); @@ -60,7 +60,7 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey, writediff(t2, t1, out); } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if(!W_ERROR_EQUAL(error1, WERR_NO_MORE_ITEMS)) { DEBUG(0, ("Error occured while getting subkey by index: %d\n", W_ERROR_V(error1))); @@ -82,7 +82,7 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey, } } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if(!W_ERROR_EQUAL(error1, WERR_NO_MORE_ITEMS)) { DEBUG(0, ("Error occured while getting value by index: %d\n", W_ERROR_V(error1))); @@ -101,7 +101,7 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey, } } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if(!W_ERROR_EQUAL(error1, WERR_NO_MORE_ITEMS)) { DEBUG(0, ("Error occured while getting value by index: %d\n", W_ERROR_V(error1))); diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 1dd0e04561..ac7dbca49b 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -329,14 +329,14 @@ static char **reg_complete_key(const char *text, int start, int end) break; } else { printf("Error creating completion list: %s\n", win_errstr(status)); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return NULL; } } if (j == 1) { /* No matches at all */ SAFE_FREE(matches); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return NULL; } @@ -345,7 +345,7 @@ static char **reg_complete_key(const char *text, int start, int end) } else { asprintf(&matches[0], "%s%s", base_n, talloc_strndup(mem_ctx, matches[1], samelen)); } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); matches[j] = NULL; return matches; @@ -435,7 +435,7 @@ static char **reg_completion(const char *text, int start, int end) if(new)curkey = new; } } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); return 0; } diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index a6beb2b484..f061f33bd3 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -47,7 +47,7 @@ static void print_tree(int l, struct registry_key *p, int fullpath, int novals) for(i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(mem_ctx, p, i, &subkey)); i++) { print_tree(l+1, subkey, fullpath, novals); } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) { DEBUG(0, ("Error occured while fetching subkeys for '%s': %s\n", p->path, win_errstr(error))); @@ -62,7 +62,7 @@ static void print_tree(int l, struct registry_key *p, int fullpath, int novals) desc = reg_val_description(mem_ctx, value); printf("%s\n", desc); } - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if(!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) { DEBUG(0, ("Error occured while fetching values for '%s': %s\n", p->path, win_errstr(error))); diff --git a/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c index d6b6bf7be4..aaa5ce0fa2 100644 --- a/source4/lib/socket/socket_ipv4.c +++ b/source4/lib/socket/socket_ipv4.c @@ -202,7 +202,7 @@ static NTSTATUS ipv4_accept(struct socket_context *sock, struct socket_context * * --metze */ - (*new_sock) = talloc_p(NULL, struct socket_context); + (*new_sock) = talloc(NULL, struct socket_context); if (!(*new_sock)) { close(new_fd); return NT_STATUS_NO_MEMORY; diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c index 27e452b14e..1dd7fe8e9d 100644 --- a/source4/lib/socket/socket_ipv6.c +++ b/source4/lib/socket/socket_ipv6.c @@ -179,7 +179,7 @@ static NTSTATUS ipv6_tcp_accept(struct socket_context *sock, struct socket_conte * --metze */ - (*new_sock) = talloc_p(NULL, struct socket_context); + (*new_sock) = talloc(NULL, struct socket_context); if (!(*new_sock)) { close(new_fd); return NT_STATUS_NO_MEMORY; diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index bdd68f9d9d..e23aa0d97e 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/lib/socket/socket_unix.c @@ -162,7 +162,7 @@ static NTSTATUS unixdom_accept(struct socket_context *sock, } } - (*new_sock) = talloc_p(NULL, struct socket_context); + (*new_sock) = talloc(NULL, struct socket_context); if (!(*new_sock)) { close(new_fd); return NT_STATUS_NO_MEMORY; diff --git a/source4/lib/unix_privs.c b/source4/lib/unix_privs.c index c65f490aeb..a57f4359d3 100644 --- a/source4/lib/unix_privs.c +++ b/source4/lib/unix_privs.c @@ -57,7 +57,7 @@ static int privileges_destructor(void *ptr) void *root_privileges(void) { struct saved_state *s; - s = talloc_p(NULL, struct saved_state); + s = talloc(NULL, struct saved_state); if (!s) return NULL; s->uid = geteuid(); if (s->uid != 0) { diff --git a/source4/lib/util_sock.c b/source4/lib/util_sock.c index 876698535b..7fe42f7ffc 100644 --- a/source4/lib/util_sock.c +++ b/source4/lib/util_sock.c @@ -428,7 +428,7 @@ int open_udp_socket(const char *host, int port) sock_out.sin_port = htons(port); sock_out.sin_family = PF_INET; - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if (connect(res,(struct sockaddr *)&sock_out,sizeof(sock_out))) { close(res); diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c index b3ec27de74..d9c4e30d6a 100644 --- a/source4/lib/util_str.c +++ b/source4/lib/util_str.c @@ -1057,7 +1057,7 @@ BOOL add_string_to_array(TALLOC_CTX *mem_ctx, { char *dup_str = talloc_strdup(mem_ctx, str); - *strings = talloc_realloc_p(mem_ctx, + *strings = talloc_realloc(mem_ctx, *strings, const char *, ((*num)+1)); diff --git a/source4/lib/util_unistr.c b/source4/lib/util_unistr.c index bd4aea7c41..e589e6493a 100644 --- a/source4/lib/util_unistr.c +++ b/source4/lib/util_unistr.c @@ -41,7 +41,7 @@ static void load_case_tables(void) } upcase_table = map_file(lib_path(mem_ctx, "upcase.dat"), 0x20000); lowcase_table = map_file(lib_path(mem_ctx, "lowcase.dat"), 0x20000); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); if (upcase_table == NULL) { upcase_table = (void *)-1; } -- cgit