fs.c: removed unused function (+ use C)

This commit is contained in:
Martin Pulec
2023-04-28 08:31:35 +02:00
parent 30e9484ff7
commit bafe32c876
3 changed files with 7 additions and 16 deletions

View File

@@ -42,9 +42,10 @@
#include "config_win32.h"
#endif
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <string.h>
#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");

View File

@@ -65,18 +65,5 @@ const char *get_install_root(void);
} // extern "C"
#endif
#ifdef __cplusplus
#include <string>
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_

View File

@@ -40,6 +40,8 @@
#ifdef __cplusplus
extern "C" {
#else
#include <stdbool.h>
#endif
// functions documented at definition