Merge pull request 'master' (#91) from YanTheKaller/libublsettings:master into master

Reviewed-on: #91
pull/92/head^2 v1.84
Dmitry Razumov 1 month ago
commit 798da6b277

@ -1547,14 +1547,14 @@ int yon_config_update_by_key(char *key){
return 0;
}
int yon_config_update_by_list(config_str keys, size_t size){
int yon_config_update_by_list(char *config_path, config_str keys, size_t size){
if (!size||!keys) return 0;
check_config{
int params_size=0;
yon_config_remove_by_list(keys,size);
config_str parameters = yon_config_get_load_parameters_by_list(&params_size,keys,size);
if (params_size&&parameters){
char *path = yon_config_command_get_path(config_last_load_command);
char *path = config_path;
char *parameters_str = yon_char_parsed_to_string(parameters,params_size," ");
char *command = yon_char_unite(ubconfig_load_command(path), parameters_str, NULL);
yon_config_load_config(YON_CONFIG_CUSTOM,command,NULL);
@ -1563,14 +1563,12 @@ int yon_config_update_by_list(config_str keys, size_t size){
return 0;
}
int yon_config_update_by_args(char *key, ...){
int yon_config_update_by_args(char *config_path, ...){
check_config{
int size=0;
config_str keys = NULL;
yon_char_parsed_add_or_create_if_exists(keys,&size,key);
va_list args;
yon_config_remove_by_key(key);
va_start(args,key);
va_start(args,config_path);
char *cur_key = NULL;
while((cur_key = va_arg(args,char*))){
yon_char_parsed_add_or_create_if_exists(keys,&size,cur_key);
@ -1580,7 +1578,7 @@ int yon_config_update_by_args(char *key, ...){
int params_size=0;
config_str parameters = yon_config_get_load_parameters_by_list(&params_size,keys,size);
if (params_size&&parameters){
char *path = yon_config_command_get_path(config_last_load_command);
char *path = config_path;
char *parameters_str = yon_char_parsed_to_string(parameters,params_size," -- get ");
char *command = yon_char_unite(ubconfig_load_command(path), parameters_str, NULL);
yon_config_load_config(YON_CONFIG_CUSTOM,command,NULL);
@ -2066,7 +2064,7 @@ int yon_config_custom_swap(yon_config_custom **target){
int yon_config_custom_apply(yon_config_custom **target){
yon_config_clean();
if (target){
if (*target){
__yon__config__strings = ((yon_config_parameter *)*target)->first;
}
*target=NULL;

@ -1562,13 +1562,13 @@ int yon_config_update_by_key(char *key);
/// @param key Parameters key list.
/// @param size size of parameters keys list.
/// @return TRUE if parameter successfully updated, FALSE if parameter doesn't registered in configuration
int yon_config_update_by_list(config_str keys, size_t size);
int yon_config_update_by_list(char *config_path,config_str keys, size_t size);
/// @brief Update parameters value from configuration.
/// @param key First parameter's key.
/// @param config_path Configuration path where from to update parameter.
/// @param ... NULL-terminated list of parameter keys.
/// @return TRUE if parameter successfully updated, FALSE if parameter doesn't registered in configuration
int yon_config_update_by_args(char *key, ...);
int yon_config_update_by_args(char *config_path, ...);
/**int yon_config_force_save_registered(char *path, char *section)
* [EN]

Loading…
Cancel
Save