Mercurial > hg > sidinfo
diff sidinfo.c @ 230:1e860046a4cc
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 03 Jan 2020 13:11:29 +0200 |
parents | 080219f105ce |
children | 1c004e74d0ad |
line wrap: on
line diff
--- a/sidinfo.c Fri Jan 03 12:04:51 2020 +0200 +++ b/sidinfo.c Fri Jan 03 13:11:29 2020 +0200 @@ -1190,7 +1190,7 @@ char *npath = th_strdup_printf("%s%c%s%c%s%s", setHVSCPath, TH_DIR_SEPARATOR, SET_HVSC_DOCUMENTS, TH_DIR_SEPARATOR, - filebase, fext); + filebase, fext != NULL ? fext : ""); if (npath != NULL && th_stat_path(npath, &sdata) && @@ -1206,6 +1206,7 @@ int main(int argc, char *argv[]) { char *setLang = th_strdup(getenv("LANG")); + th_ioctx *inFile = NULL; // Initialize th_init("SIDInfo", "PSID/RSID information displayer", "0.8.0", @@ -1280,6 +1281,7 @@ // If SLDB path is not set, autocheck for .md5 and .txt if (setSLDBPath == NULL) setSLDBPath = siCheckHVSCFilePath(SET_SLDB_FILEBASE, ".md5"); + if (setSLDBPath == NULL) setSLDBPath = siCheckHVSCFilePath(SET_SLDB_FILEBASE, ".txt"); } @@ -1288,7 +1290,6 @@ { // Initialize SLDB int ret = THERR_OK; - th_ioctx *inFile = NULL; setSLDBNewFormat = th_strrcasecmp(setSLDBPath, ".md5") != NULL; @@ -1316,7 +1317,6 @@ ret, th_error_str(ret)); goto err; } - th_io_close(inFile); if ((ret = sidlib_sldb_build_index(sidSLDB)) != THERR_OK) { @@ -1327,6 +1327,7 @@ err: th_io_close(inFile); + inFile = NULL; } // Process files