From 350fbda6335075a192df24f0a39878493458e1d6 Mon Sep 17 00:00:00 2001 From: NightlyFox Date: Sun, 23 Sep 2018 13:34:35 -0500 Subject: [PATCH] got rid of booleans, initialized pointers with default values --- common/menu-entry.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/common/menu-entry.c b/common/menu-entry.c index fd1d890..a5a7635 100644 --- a/common/menu-entry.c +++ b/common/menu-entry.c @@ -298,35 +298,24 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) { config_t cfg = {0}; config_init(&cfg); config_setting_t *themeInfo; - const char *name, *author, *version; - bool noAuth = false, noVers = false; + const char *name, + *author = textGetString(StrId_DefaultPublisher), + *version = "1.0.0"; + if(config_read_file(&cfg, me->path)) { themeInfo = config_lookup(&cfg, "themeInfo"); if (themeInfo != NULL) { if(config_setting_lookup_string(themeInfo, "name", &name)) strncpy(me->name, name, sizeof(me->name)-1); if(!config_setting_lookup_string(themeInfo, "author", &author)) - noAuth = true; + author = textGetString(StrId_DefaultPublisher); if(!config_setting_lookup_string(themeInfo, "version", &version))\ - noVers = true; - } - else { - noAuth = true; - noVers = true; + version = "1.0.0"; } } - else { - noAuth = true; - noVers = true; - } - if(noAuth) - strncpy(me->author, textGetString(StrId_DefaultPublisher), sizeof(me->author)-1); - else - strncpy(me->author, author, sizeof(me->author)-1); - if(noVers) - strncpy(me->version, "1.0.0", sizeof(me->version)-1); - else - strncpy(me->version, version, sizeof(me->version)-1); + + strncpy(me->author, author, sizeof(me->author)-1); + strncpy(me->version, version, sizeof(me->version)-1); config_destroy(&cfg); }