From: Holger Schemel Date: Fri, 24 Aug 2018 10:45:38 +0000 (+0200) Subject: removed storing two strings in function for level filenames X-Git-Tag: 4.1.1.0~58 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6cbd0028a9da3f09329f30e2424160fa0bc1882d;p=rocksndiamonds.git removed storing two strings in function for level filenames Before, the function "getLevelFilenameFromBasename()" stored two filenames in static string pointers, one for the level filename, and one for the corresponding level template filename, because the results were only used as references before. As they are now stored as string copies outside if this function, it is sufficient to only store the last result. This change is directly related to commit 759e0bea. --- diff --git a/src/files.c b/src/files.c index b590641a..bc996816 100644 --- a/src/files.c +++ b/src/files.c @@ -1935,14 +1935,13 @@ static void ActivateLevelTemplate() static char *getLevelFilenameFromBasename(char *basename) { - static char *filename[2] = { NULL, NULL }; - int pos = (strEqual(basename, LEVELTEMPLATE_FILENAME) ? 0 : 1); + static char *filename = NULL; - checked_free(filename[pos]); + checked_free(filename); - filename[pos] = getPath2(getCurrentLevelDir(), basename); + filename = getPath2(getCurrentLevelDir(), basename); - return filename[pos]; + return filename; } static int getFileTypeFromBasename(char *basename)