Bugfixes and cleanup

This commit is contained in:
ctcaer@gmail.com
2019-07-06 22:08:37 +03:00
parent d55634638f
commit 08b84384a6
39 changed files with 319 additions and 481 deletions

View File

@@ -31,6 +31,9 @@ extern hekate_config h_cfg;
extern bool sd_mount();
extern void sd_unmount(bool deinit);
#pragma GCC push_options
#pragma GCC target ("thumb")
void set_default_configuration()
{
h_cfg.autoboot = 0;
@@ -158,8 +161,7 @@ int create_config_entry()
f_close(&fp);
sd_unmount(false);
if (mainIniFound)
ini_free(&ini_sections);
return 0;
}
#pragma GCC pop_options

View File

@@ -178,64 +178,6 @@ int ini_parse(link_t *dst, char *ini_path, bool is_dir)
return 1;
}
void ini_free(link_t *dst)
{
if (!dst->prev || !dst->next)
return;
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, dst, link)
{
if (ini_sec->type == INI_CHOICE)
{
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ini_sec->kvs, link)
{
free(kv->key);
free(kv->val);
//free(kv);
}
}
free(ini_sec->name);
//free(ini_sec);
}
list_init(dst);
}
ini_sec_t *ini_clone_section(ini_sec_t *cfg)
{
if (cfg == NULL)
return NULL;
ini_sec_t *csec = (ini_sec_t *)malloc(sizeof(ini_sec_t));
list_init(&csec->kvs);
LIST_FOREACH_ENTRY(ini_kv_t, kv, &cfg->kvs, link)
{
ini_kv_t *kvcfg = (ini_kv_t *)malloc(sizeof(ini_kv_t));
kvcfg->key = _strdup(kv->key);
kvcfg->val = _strdup(kv->val);
list_append(&csec->kvs, &kvcfg->link);
}
return csec;
}
void ini_free_section(ini_sec_t *cfg)
{
if (cfg == NULL)
return;
LIST_FOREACH_ENTRY(ini_kv_t, kv, &cfg->kvs, link)
{
free(kv->key);
free(kv->val);
//free(kv);
}
//free(cfg);
cfg = NULL;
}
char *ini_check_payload_section(ini_sec_t *cfg)
{
char *path = NULL;

View File

@@ -44,9 +44,6 @@ typedef struct _ini_sec_t
} ini_sec_t;
int ini_parse(link_t *dst, char *ini_path, bool is_dir);
void ini_free(link_t *dst);
ini_sec_t *ini_clone_section(ini_sec_t *cfg);
void ini_free_section(ini_sec_t *cfg);
char *ini_check_payload_section(ini_sec_t *cfg);
#endif