diff options
author | Michael Adam <obnox@samba.org> | 2009-07-08 13:58:52 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-07-15 14:01:52 +0200 |
commit | 1c65c98f3350951fe9f87a942b4c8a8094c8b781 (patch) | |
tree | c21d9f9fc75db70ead3c998c3e5277df29c60fe6 /source3/registry/reg_backend_db.c | |
parent | cf4f808b8b03c385b5b9e9f4a5e891ae92143001 (diff) | |
download | samba-1c65c98f3350951fe9f87a942b4c8a8094c8b781.tar.gz samba-1c65c98f3350951fe9f87a942b4c8a8094c8b781.tar.xz samba-1c65c98f3350951fe9f87a942b4c8a8094c8b781.zip |
s3:registry: refactor adding of builtin reg values out
into regdb_ctr_add_value(). For readability.
Michael
Diffstat (limited to 'source3/registry/reg_backend_db.c')
-rw-r--r-- | source3/registry/reg_backend_db.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index bed9535f17f..d04d34bac05 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -240,6 +240,31 @@ WERROR init_registry_key(const char *add_path) Open the registry data in the tdb ***********************************************************************/ +static void regdb_ctr_add_value(struct regval_ctr *ctr, + struct builtin_regkey_value *value) +{ + UNISTR2 data; + + switch(value->type) { + case REG_DWORD: + regval_ctr_addvalue(ctr, value->valuename, REG_DWORD, + (char*)&value->data.dw_value, + sizeof(uint32)); + break; + + case REG_SZ: + init_unistr2(&data, value->data.string, UNI_STR_TERMINATE); + regval_ctr_addvalue(ctr, value->valuename, REG_SZ, + (char*)data.buffer, + data.uni_str_len*sizeof(uint16)); + break; + + default: + DEBUG(0, ("regdb_ctr_add_value: invalid value type in " + "registry values [%d]\n", value->type)); + } +} + static NTSTATUS init_registry_data_action(struct db_context *db, void *private_data) { @@ -247,7 +272,6 @@ static NTSTATUS init_registry_data_action(struct db_context *db, TALLOC_CTX *frame = talloc_stackframe(); struct regval_ctr *values; int i; - UNISTR2 data; /* loop over all of the predefined paths and add each component */ @@ -281,32 +305,8 @@ static NTSTATUS init_registry_data_action(struct db_context *db, if (!regval_ctr_key_exists(values, builtin_registry_values[i].valuename)) { - switch(builtin_registry_values[i].type) { - case REG_DWORD: - regval_ctr_addvalue(values, - builtin_registry_values[i].valuename, - REG_DWORD, - (char*)&builtin_registry_values[i].data.dw_value, - sizeof(uint32)); - break; - - case REG_SZ: - init_unistr2(&data, - builtin_registry_values[i].data.string, - UNI_STR_TERMINATE); - regval_ctr_addvalue(values, - builtin_registry_values[i].valuename, - REG_SZ, - (char*)data.buffer, - data.uni_str_len*sizeof(uint16)); - break; - - default: - DEBUG(0, ("init_registry_data: invalid value " - "type in builtin_registry_values " - "[%d]\n", - builtin_registry_values[i].type)); - } + regdb_ctr_add_value(values, + &builtin_registry_values[i]); regdb_store_values_internal(db, builtin_registry_values[i].path, values); |