diff --git a/CMakeLists.txt b/CMakeLists.txt index 2838621..cb64e47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,12 +47,6 @@ else() set(MAX_LOG_SIZE_VAL 100) endif() -if(DEFINED PRE_LOG_SIZE) -set(PRE_LOG_SIZE_VAL ${PRE_LOG_SIZE}) -else() -set(PRE_LOG_SIZE_VAL 10) -endif() - if(DEFINED CONSERVATIVE_DISK_SAVE) set(CONSERVATIVE_DISK_SAVE_VAL ${CONSERVATIVE_DISK_SAVE}) else() diff --git a/ccash_config.hpp.in b/ccash_config.hpp.in index e875840..0266248 100644 --- a/ccash_config.hpp.in +++ b/ccash_config.hpp.in @@ -1,19 +1,18 @@ #pragma once // Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable) -#define MAX_LOG_SIZE @MAX_LOG_SIZE_VAL@ -#define PRE_LOG_SIZE @PRE_LOG_SIZE_VAL@ +#define MAX_LOG_SIZE @MAX_LOG_SIZE_VAL @ //default to minecraft usernames constexpr unsigned min_name_size = 3; constexpr unsigned max_name_size = 16; -constexpr const char *users_location = @USER_SAVE@; -constexpr const char *config_location = @DROGON_CONFIG@; +constexpr const char *users_location = @USER_SAVE @; +constexpr const char *config_location = @DROGON_CONFIG @; // Returns money to an account on deletion (useful if you dont want any money to leave the economy) -#define RETURN_ON_DEL @RETURN_ON_DEL_VAL@ -constexpr const char *return_account = @RETURN_ON_DEL_NAME_VAL@; +#define RETURN_ON_DEL @RETURN_ON_DEL_VAL @ +constexpr const char *return_account = @RETURN_ON_DEL_NAME_VAL @; /* if true, when frequency is hit AND changes have happened then save @@ -27,7 +26,7 @@ if false, when frequency is hit save cons HIGH disk usage */ -#define CONSERVATIVE_DISK_SAVE @CONSERVATIVE_DISK_SAVE_VAL@ +#define CONSERVATIVE_DISK_SAVE @CONSERVATIVE_DISK_SAVE_VAL @ /* example, when set to 2 @@ -38,4 +37,4 @@ etc */ #define API_VERSION 1 -#define MULTI_THREADED @MULTI_THREADED_VAL@ \ No newline at end of file +#define MULTI_THREADED @MULTI_THREADED_VAL @ \ No newline at end of file diff --git a/src/log.cpp b/src/log.cpp index 8c58a44..f2b3a04 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -14,10 +14,6 @@ void Log::AddTrans(Transaction &&t) noexcept data[data.size() - 1] = std::move(t); // Place new in opened spot return; } - else if (data.size() == data.capacity()) // If we haven't hit the max but hit capacity - { - data.reserve(data.capacity() + PRE_LOG_SIZE); // Reserve more memory - } data.push_back(std::move(t)); // In either case we have space under max length, move to new spot #endif log_flag.SetChangesOn(); diff --git a/src/user.cpp b/src/user.cpp index 1f46ca4..85251a5 100644 --- a/src/user.cpp +++ b/src/user.cpp @@ -27,9 +27,6 @@ User::User(uint32_t init_bal, XXH64_hash_t init_pass, const Json::Value &log_j) { if (log_j.size()) { -#if MAX_LOG_SIZE != 1 - log.data.reserve(std::min((size_t)PRE_LOG_SIZE * ((log_j.size() / PRE_LOG_SIZE) + 1), (size_t)MAX_LOG_SIZE)); -#endif for (uint32_t i = (log_j.size() - MAX_LOG_SIZE) * (log_j.size() > MAX_LOG_SIZE); i < log_j.size(); i++) { #if MAX_LOG_SIZE == 1