From bafe32c876ebd8208546d8b2ee39aee791cd64ab Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 28 Apr 2023 08:31:35 +0200 Subject: [PATCH] fs.c: removed unused function (+ use C) --- src/utils/{fs.cpp => fs.c} | 8 +++++--- src/utils/fs.h | 13 ------------- src/utils/string.h | 2 ++ 3 files changed, 7 insertions(+), 16 deletions(-) rename src/utils/{fs.cpp => fs.c} (96%) diff --git a/src/utils/fs.cpp b/src/utils/fs.c similarity index 96% rename from src/utils/fs.cpp rename to src/utils/fs.c index c36999f40..545248870 100644 --- a/src/utils/fs.cpp +++ b/src/utils/fs.c @@ -42,9 +42,10 @@ #include "config_win32.h" #endif +#include #include #include -#include +#include #include "utils/fs.h" #include "utils/string.h" @@ -65,7 +66,8 @@ const char *get_temp_dir(void) return NULL; } #else - if (char *req_tmp_dir = getenv("TMPDIR")) { + const char *req_tmp_dir = getenv("TMPDIR"); + if (req_tmp_dir) { temp_dir[sizeof temp_dir - 1] = '\0'; strncpy(temp_dir, req_tmp_dir, sizeof temp_dir - 1); } else { @@ -141,7 +143,7 @@ const char *get_install_root(void) { * both FILE pointer and file name. */ FILE *get_temp_file(const char **filename) { - static thread_local char filename_buf[MAX_PATH_SIZE]; + static _Thread_local char filename_buf[MAX_PATH_SIZE]; #ifdef _WIN32 *filename = tmpnam(filename_buf); return fopen(*filename, "wbx"); diff --git a/src/utils/fs.h b/src/utils/fs.h index 13548229a..355fd0c64 100644 --- a/src/utils/fs.h +++ b/src/utils/fs.h @@ -65,18 +65,5 @@ const char *get_install_root(void); } // extern "C" #endif -#ifdef __cplusplus -#include - -inline std::string get_executable_path(){ - std::string path(MAX_PATH_SIZE, '\0'); - if (!get_exec_path(path.data())){ - return ""; - } - path.erase(path.find('\0')); - return path; -} -#endif - #endif// UTILS_FS_H_ diff --git a/src/utils/string.h b/src/utils/string.h index badba6ba7..8ca265231 100644 --- a/src/utils/string.h +++ b/src/utils/string.h @@ -40,6 +40,8 @@ #ifdef __cplusplus extern "C" { +#else +#include #endif // functions documented at definition