Reorganize file structure again. Fix confusing issue dealing with null terminators with static_string using an array for initialization
This commit is contained in:
parent
ed1c6dd211
commit
7351e3be10
@ -5,8 +5,8 @@ project(librexy)
|
|||||||
set(librexy_VERSION_MAJOR 0)
|
set(librexy_VERSION_MAJOR 0)
|
||||||
set(librexy_VERSION_MINOR 1)
|
set(librexy_VERSION_MINOR 1)
|
||||||
set(librexy_VERSION_REVISION 0)
|
set(librexy_VERSION_REVISION 0)
|
||||||
set(INCLUDE_PATH ${CMAKE_SOURCE_DIR})
|
set(INCLUDE_PATH ${CMAKE_SOURCE_DIR}/include)
|
||||||
include_directories("${INCLUDE_PATH}")
|
include_directories(BEFORE SYSTEM "${INCLUDE_PATH}")
|
||||||
|
|
||||||
set(LIBREXY_LIBFLAGS "-lrexy")
|
set(LIBREXY_LIBFLAGS "-lrexy")
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ option(ENABLE_SHARED "Build shared library" ON)
|
|||||||
option(ENABLE_PROFILING "Enable asan" OFF)
|
option(ENABLE_PROFILING "Enable asan" OFF)
|
||||||
mark_as_advanced(ENABLE_PROFILING)
|
mark_as_advanced(ENABLE_PROFILING)
|
||||||
|
|
||||||
set(SOURCE_LIST "rexy/src/binary.cpp" "rexy/src/string_base.cpp" "rexy/src/filerd.cpp")
|
set(SOURCE_LIST "src/binary.cpp" "src/string_base.cpp" "src/filerd.cpp")
|
||||||
if(ENABLE_SHARED)
|
if(ENABLE_SHARED)
|
||||||
add_library(rexy SHARED ${SOURCE_LIST})
|
add_library(rexy SHARED ${SOURCE_LIST})
|
||||||
set_target_properties(rexy PROPERTIES SOVERSION "${librexy_VERSION_MAJOR}.${librexy_VERSION_MINOR}.${librexy_VERSION_REVISION}")
|
set_target_properties(rexy PROPERTIES SOVERSION "${librexy_VERSION_MAJOR}.${librexy_VERSION_MINOR}.${librexy_VERSION_REVISION}")
|
||||||
@ -27,7 +27,7 @@ if(ENABLE_PROFILING)
|
|||||||
target_link_options(rexy PRIVATE -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
target_link_options(rexy PRIVATE -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LIBREXY_PUBLIC_HEADERS "rexy/include/binary.hpp" "rexy/include/string_base.hpp" "rexy/include/string.hpp" "rexy/include/filerd.hpp" "rexy/include/string_base.tpp" "rexy/include/detail/binary_string_conv.hpp" "rexy/include/detail/default_allocator.hpp" "rexy/include/detail/util.hpp")
|
set(LIBREXY_PUBLIC_HEADERS "include/rexy/binary.hpp" "include/rexy/string_base.hpp" "include/rexy/string.hpp" "include/rexy/filerd.hpp" "include/rexy/string_base.tpp" "include/rexy/detail/binary_string_conv.hpp" "include/rexy/detail/default_allocator.hpp" "include/rexy/detail/util.hpp")
|
||||||
target_compile_options(rexy PRIVATE -Wall -Wextra -pedantic -std=c++17)
|
target_compile_options(rexy PRIVATE -Wall -Wextra -pedantic -std=c++17)
|
||||||
|
|
||||||
install(TARGETS rexy
|
install(TARGETS rexy
|
||||||
|
|||||||
@ -137,8 +137,6 @@ namespace rexy{
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
constexpr static_string(void) = default;
|
constexpr static_string(void) = default;
|
||||||
template<size_t N>
|
|
||||||
constexpr static_string(const char(&str)[N]);
|
|
||||||
constexpr static_string(const char* str, size_t len);
|
constexpr static_string(const char* str, size_t len);
|
||||||
static_string(const char* c);
|
static_string(const char* c);
|
||||||
constexpr static_string(const static_string& s);
|
constexpr static_string(const static_string& s);
|
||||||
@ -218,9 +218,6 @@ namespace rexy{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<size_t N>
|
|
||||||
constexpr static_string::static_string(const char(&str)[N]):
|
|
||||||
string_base(const_cast<char*>(str), N, N){}
|
|
||||||
constexpr static_string::static_string(const char* str, size_t len):
|
constexpr static_string::static_string(const char* str, size_t len):
|
||||||
string_base(const_cast<char*>(str), len, len){}
|
string_base(const_cast<char*>(str), len, len){}
|
||||||
constexpr static_string::static_string(const static_string& s):
|
constexpr static_string::static_string(const static_string& s):
|
||||||
@ -16,7 +16,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rexy/include/binary.hpp"
|
#include "rexy/binary.hpp"
|
||||||
|
|
||||||
namespace rexy{
|
namespace rexy{
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rexy/include/filerd.hpp"
|
#include "rexy/filerd.hpp"
|
||||||
|
|
||||||
#include <cstdio> //fopen, fclose
|
#include <cstdio> //fopen, fclose
|
||||||
#include <utility> //exchange, swap
|
#include <utility> //exchange, swap
|
||||||
@ -16,7 +16,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rexy/include/string_base.hpp"
|
#include "rexy/string_base.hpp"
|
||||||
|
|
||||||
#include <utility> //exchange, swap
|
#include <utility> //exchange, swap
|
||||||
#include <cstdlib> //memcpy
|
#include <cstdlib> //memcpy
|
||||||
Loading…
x
Reference in New Issue
Block a user