Fixes for ConstString
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-05-02 15:30:25 +02:00
parent 517f95bfc5
commit 84b08f66e5
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 11 additions and 15 deletions

View File

@ -4,18 +4,18 @@ project(Arbutils)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_STANDARD 17)
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
if (SHARED)
add_library(Arbutils SHARED ${SRC_FILES})
else()
add_library(Arbutils STATIC ${SRC_FILES})
endif(SHARED)
set_target_properties(Arbutils PROPERTIES LINKER_LANGUAGE CXX)
if (WINDOWS)
ADD_DEFINITIONS(-D WINDOWS=1)
endif (WINDOWS)
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
set(LIBTYPE STATIC)
if (SHARED)
set(LIBTYPE SHARED)
endif(SHARED)
add_library(Arbutils ${LIBTYPE} ${SRC_FILES})
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
if (NOT DEFINED CONAN_EXPORTED)
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)

View File

@ -1,4 +1,4 @@
#include "ConstString.hpp"
Arbutils::__ConstStringCharHolder* Arbutils::CaseInsensitiveConstString::__emptyString = nullptr;
Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = nullptr;
Arbutils::__ConstStringCharHolder* Arbutils::CaseInsensitiveConstString::__emptyString = new __ConstStringCharHolder("", 0);;
Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = new __ConstStringCharHolder("", 0);;

View File

@ -17,11 +17,7 @@
hashFunction; \
\
static __ConstStringCharHolder* __emptyString; \
static inline __ConstStringCharHolder* GetEmptyString() { \
if (__emptyString == nullptr) \
__emptyString = new __ConstStringCharHolder("", 0); \
return __emptyString; \
} \
static inline __ConstStringCharHolder* GetEmptyString() { return __emptyString; } \
\
inline static int constexpr Length(const char* str) { return *str ? 1 + Length(str + 1) : 0; } \
inline __ConstStringCharHolder* CloneHolder() const noexcept { \