diff options
author | rubidium <rubidium@openttd.org> | 2009-11-09 09:27:48 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-09 09:27:48 +0000 |
commit | 37027467567dd0b75bbb932cdab87da3ff24dedd (patch) | |
tree | 2841920ca76366612d11f5d1c443f52ae440fffd | |
parent | 6db598e408f069a78714631868a7b4afd4782605 (diff) | |
download | openttd-37027467567dd0b75bbb932cdab87da3ff24dedd.tar.xz |
(svn r18026) -Codechange: make a lookup table static that doesn't need to be 'exported'
-rw-r--r-- | src/fileio.cpp | 6 | ||||
-rw-r--r-- | src/fileio_func.h | 7 |
2 files changed, 3 insertions, 10 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp index f8f4d0d70..45d88b82c 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -212,7 +212,7 @@ void FioOpenFile(int slot, const char *filename) FioSeekToFile(slot, pos); } -const char *_subdirs[NUM_SUBDIRS] = { +static const char *_subdirs[NUM_SUBDIRS] = { "", "save" PATHSEP, "save" PATHSEP "autosave" PATHSEP, @@ -957,7 +957,7 @@ void DeterminePaths(const char *exe) }; for (uint i = 0; i < lengthof(default_subdirs); i++) { - char *dir = str_fmt("%s%s", _personal_dir, FioGetSubdirectory(default_subdirs[i])); + char *dir = str_fmt("%s%s", _personal_dir, _subdirs[default_subdirs[i]]); FioCreateDirectory(dir); free(dir); } @@ -970,7 +970,7 @@ void DeterminePaths(const char *exe) /* Create the directory for each of the types of content */ const Subdirectory dirs[] = { SCENARIO_DIR, HEIGHTMAP_DIR, DATA_DIR, AI_DIR, AI_LIBRARY_DIR }; for (uint i = 0; i < lengthof(dirs); i++) { - char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], FioGetSubdirectory(dirs[i])); + char *tmp = str_fmt("%s%s", _searchpaths[SP_AUTODOWNLOAD_DIR], _subdirs[dirs[i]]); FioCreateDirectory(tmp); free(tmp); } diff --git a/src/fileio_func.h b/src/fileio_func.h index 2bb0ecc05..b2d2da803 100644 --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -56,13 +56,6 @@ char *FioFindFullPath(char *buf, size_t buflen, Subdirectory subdir, const char char *FioAppendDirectory(char *buf, size_t buflen, Searchpath sp, Subdirectory subdir); char *FioGetDirectory(char *buf, size_t buflen, Subdirectory subdir); -static inline const char *FioGetSubdirectory(Subdirectory subdir) -{ - extern const char *_subdirs[NUM_SUBDIRS]; - assert(subdir < NUM_SUBDIRS); - return _subdirs[subdir]; -} - void SanitizeFilename(char *filename); void AppendPathSeparator(char *buf, size_t buflen); void DeterminePaths(const char *exe); |