diff options
author | Michael Adam <obnox@samba.org> | 2007-09-13 22:36:10 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:30:44 -0500 |
commit | aaa0afaa268e97dafea1ec9b03fa9630880a4fe7 (patch) | |
tree | e8ac2bfef5bdf23346e2e43f518b47e898940ce5 /source3/registry | |
parent | eacd3140573d1122a3785823e4003bfc6352c431 (diff) | |
download | samba-aaa0afaa268e97dafea1ec9b03fa9630880a4fe7.tar.gz samba-aaa0afaa268e97dafea1ec9b03fa9630880a4fe7.tar.bz2 samba-aaa0afaa268e97dafea1ec9b03fa9630880a4fe7.zip |
r25139: Avoid code duplication: let regval_ctr_copyvalue() call regval_ctr_addvalue().
This also corrects regval_ctr_copyvalue() in that it cannot create (invalid)
regval containers with dupliacte entries...
Michael
(This used to be commit 2daaaaa835078c543fa12cd1819e8a3d86cf6e5e)
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_objects.c | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c index 499b7c350f..89fdae7b8c 100644 --- a/source3/registry/reg_objects.c +++ b/source3/registry/reg_objects.c @@ -347,43 +347,8 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, const char *name, uint16 type, int regval_ctr_copyvalue( REGVAL_CTR *ctr, REGISTRY_VALUE *val ) { if ( val ) { - /* allocate a slot in the array of pointers */ - - if ( ctr->num_values == 0 ) { - ctr->values = TALLOC_P( ctr, REGISTRY_VALUE *); - } else { - ctr->values = TALLOC_REALLOC_ARRAY( ctr, ctr->values, REGISTRY_VALUE *, ctr->num_values+1 ); - } - - if (!ctr->values) { - ctr->num_values = 0; - return 0; - } - - /* allocate a new value and store the pointer in the arrya */ - - ctr->values[ctr->num_values] = TALLOC_P( ctr, REGISTRY_VALUE); - if (!ctr->values[ctr->num_values]) { - ctr->num_values = 0; - return 0; - } - - /* init the value */ - - fstrcpy( ctr->values[ctr->num_values]->valuename, val->valuename ); - ctr->values[ctr->num_values]->type = val->type; - if (val->size) { - ctr->values[ctr->num_values]->data_p = (uint8 *)TALLOC_MEMDUP( - ctr, val->data_p, val->size ); - if (!ctr->values[ctr->num_values]->data_p) { - ctr->num_values = 0; - return 0; - } - } else { - ctr->values[ctr->num_values]->data_p = NULL; - } - ctr->values[ctr->num_values]->size = val->size; - ctr->num_values++; + regval_ctr_addvalue(ctr, val->valuename, val->type, + (char *)val->data_p, val->size); } return ctr->num_values; |