This commit is contained in:
Felix Brendel
2020-09-29 17:31:35 +02:00
parent faa4c5134b
commit eb1d178de3
3 changed files with 21 additions and 1 deletions
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#if defined(_WIN32) || defined(_WIN64)
#pragma message("Compiling for Windows")
#define FTB_WINDOWS
#elseif
#pragma message("Compiling for Linux")
#define FTB_LINUX
#endif
+2
View File
@@ -1,3 +1,5 @@
#include "./types.hpp"
typedef s32 testresult;
#define epsilon 2.2204460492503131E-16
+10 -1
View File
@@ -1,5 +1,6 @@
#pragma once
#include "platform.hpp"
#include <stdint.h>
#include <string.h>
@@ -27,10 +28,18 @@ struct String {
char* data;
};
inline auto heap_copy_c_string(const char* str) -> char* {
#ifdef FTB_WINDOWS
return _strdup(str);
#else
return strdup(str);
#endif
}
inline auto make_heap_string(const char* str) -> String {
String ret;
ret.length = strlen(str);
ret.data = _strdup(str);
ret.data = heap_copy_c_string(str);
return ret;
}