From 44707ad2e00a91f459e80efbe8f362b5853b0a62 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 29 Aug 2005 14:55:40 +0000 Subject: r9739: conver the reg_objects (REGSUBKEY_CTR & REGVAL_CTR) to use the new talloc() features: Note that the REGSUB_CTR and REGVAL_CTR objects *must* be talloc()'d since the methods use the object pointer as the talloc context for internal private data. There is no longer a regXXX_ctr_intit() and regXXX_ctr_destroy() pair of functions. Simply TALLOC_ZERO_P() and TALLOC_FREE() the object. Also had to convert the printer_info_2->NT_PRINTER_DATA field to be talloc()'d as well. This is just a stop on the road to cleaning up the printer memory management. (This used to be commit ef721333ab9639cb5346067497e99fbd0d4425dd) --- source3/registry/reg_printing.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source3/registry/reg_printing.c') diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index c1f7d3925f..d0f7daa926 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -261,7 +261,7 @@ static int key_printers_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys ) return -1; } - num_subkeys = get_printer_subkeys( &printer->info_2->data, printerdatakey?printerdatakey:"", &subkey_names ); + num_subkeys = get_printer_subkeys( printer->info_2->data, printerdatakey?printerdatakey:"", &subkey_names ); for ( i=0; iinfo_2->data, "", &existing_subkeys ); + num_existing_keys = get_printer_subkeys( printer->info_2->data, "", &existing_subkeys ); for ( i=0; iinfo_2->data, existing_subkeys[i] ); + delete_printer_key( printer->info_2->data, existing_subkeys[i] ); } } @@ -362,10 +362,10 @@ static BOOL key_printers_store_keys( const char *key, REGSUBKEY_CTR *subkeys ) for ( i=0; iinfo_2->data, subkeyname) == -1 ) { + if ( lookup_printerkey(printer->info_2->data, subkeyname) == -1 ) { DEBUG(5,("key_printers_store_keys: adding key %s\n", existing_subkeys[i])); - if ( add_new_printer_key( &printer->info_2->data, subkeyname ) == -1 ) + if ( add_new_printer_key( printer->info_2->data, subkeyname ) == -1 ) return False; } } @@ -445,7 +445,7 @@ static void fill_in_printer_values( NT_PRINTER_INFO_LEVEL_2 *info2, REGVAL_CTR * /* use a prs_struct for converting the devmode and security descriptor to REG_BINARY */ - prs_init( &prs, MAX_PDU_FRAG_LEN, regval_ctr_getctx(values), MARSHALL); + prs_init( &prs, MAX_PDU_FRAG_LEN, values, MARSHALL); /* stream the device mode */ @@ -508,7 +508,7 @@ static int key_printers_fetch_values( const char *key, REGVAL_CTR *values ) /* iterate over all printer data keys and fill the regval container */ - p_data = &printer->info_2->data; + p_data = printer->info_2->data; if ( (key_index = lookup_printerkey( p_data, printerdatakey )) == -1 ) { /* failure....should never happen if the client has a valid open handle first */ DEBUG(10,("key_printers_fetch_values: Unknown keyname [%s]\n", printerdatakey)); @@ -517,9 +517,9 @@ static int key_printers_fetch_values( const char *key, REGVAL_CTR *values ) return -1; } - num_values = regval_ctr_numvals( &p_data->keys[key_index].values ); + num_values = regval_ctr_numvals( p_data->keys[key_index].values ); for ( i=0; ikeys[key_index].values, i) ); + regval_ctr_copyvalue( values, regval_ctr_specific_value(p_data->keys[key_index].values, i) ); done: @@ -702,7 +702,7 @@ static BOOL key_printers_store_values( const char *key, REGVAL_CTR *values ) int i; REGISTRY_VALUE *val; - delete_printer_key( &printer->info_2->data, keyname ); + delete_printer_key( printer->info_2->data, keyname ); /* deal with any subkeys */ for ( i=0; i