From 5084cf3def65e09bccf0bfc0815d12da7de43bb7 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 16 Jan 2024 17:24:09 +0600 Subject: [PATCH] Changed register function to spent less memory --- source/libublsettings.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libublsettings.c b/source/libublsettings.c index b366a37..43cb371 100644 --- a/source/libublsettings.c +++ b/source/libublsettings.c @@ -1210,18 +1210,20 @@ void yon_config_register(char *key, char *config_section, void *data){ if (!__yon__config__strings||!yon_dictionary_get((dictionary**)&__yon__config__strings,key)){ yon_config_parameter_add_or_create_if_exists_with_data(__yon__config__strings,key,yon_char_new(data)); __yon__config__strings->flag1=1; + __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; + __yon__config__strings->section=yon_char_new(config_section); } else if (yon_dictionary_get((dictionary**)&__yon__config__strings,key)){ if (data!=__yon__config__strings->data&&strcmp(__yon__config__strings->data,data)){ __yon__config__strings->data=yon_char_new(data); __yon__config__strings->flag1=1; + __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; + __yon__config__strings->section=yon_char_new(config_section); if (yon_dictionary_get(&__yon_config_ignored, __yon__config__strings->key)){ yon_dictionary_rip(__yon_config_ignored); } } } - __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; - __yon__config__strings->section=yon_char_new(config_section); } config_str yon_config_load(char *command, int *str_len){