Fixed removing of default-equaled parameters

pull/40/head
parent d7c9a3caba
commit 3c582b0786

@ -1764,6 +1764,11 @@ void yon_config_register(char *key, char *config_load, void *data){
if (data){ if (data){
if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){ if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
{ {
yon_config_parameter *cur_default = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__default__strings,key);
if ((cur_default&&cur_default->data&&!strcmp((char*)cur_default->data,(char*)data))){
yon_config_remove_by_key(current->key);
return;
}
if (__yon__config__strings){ if (__yon__config__strings){
char *data_copy = yon_char_new(data); char *data_copy = yon_char_new(data);
yon_config_parameter* dict=NULL; yon_config_parameter* dict=NULL;
@ -1790,10 +1795,6 @@ void yon_config_register(char *key, char *config_load, void *data){
yon_char_parsed_free(section,size); yon_char_parsed_free(section,size);
} }
else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){ else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
yon_config_parameter *cur_default = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__default__strings,current->key);
if ((cur_default&&((yon_config_parameter*)current)->flag1==1&&!strcmp((char*)cur_default->data,(char*)data))){
yon_config_remove_by_key(current->key);
} else if ((current->data&&data!=__yon__config__strings->data&&strcmp(__yon__config__strings->data,data))||!current->data){
current->data=yon_char_new(data); current->data=yon_char_new(data);
current->flag1=1; current->flag1=1;
current->data_type=DICTIONARY_CHAR_TYPE; current->data_type=DICTIONARY_CHAR_TYPE;
@ -1806,7 +1807,6 @@ void yon_config_register(char *key, char *config_load, void *data){
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]); current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
yon_char_parsed_free(section,size); yon_char_parsed_free(section,size);
} }
}
} else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))) { } else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))) {
current->data=NULL; current->data=NULL;
current->flag1=0; current->flag1=0;

Loading…
Cancel
Save