From bdffb979fbd9732f1ff928674930375e5d68e8dc Mon Sep 17 00:00:00 2001 From: radkesvat <134321679+radkesvat@users.noreply.github.com> Date: Tue, 23 Apr 2024 11:10:22 +0000 Subject: [PATCH] small reformat --- .gitattributes | 1 + CMakeLists.txt | 2 +- in_use | 0 ww/buffer_pool.c | 12 ++++++------ ww/eventloop/.gitattributes | 1 - ww/frand.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 .gitattributes delete mode 100644 in_use delete mode 100644 ww/eventloop/.gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..15a5c580 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.h linguist-language=C diff --git a/CMakeLists.txt b/CMakeLists.txt index 07d112e5..7e106e6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ endif() # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address" CACHE STRING "my configurable string" FORCE) # set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address" CACHE STRING "my configurable string" FORCE) -set(ENABLE_ASAN ON CACHE BOOL "enable address sanitizer" FORCE) +set(ENABLE_ASAN OFF CACHE BOOL "enable address sanitizer" FORCE) option(INCLUDE_TCP_LISTENER "link TcpListener staticly to the core" TRUE) option(INCLUDE_LOGGER_TUNNEL "link LoggerTunnel staticly to the core" TRUE) diff --git a/in_use b/in_use deleted file mode 100644 index e69de29b..00000000 diff --git a/ww/buffer_pool.c b/ww/buffer_pool.c index f473d0d9..19b834f0 100644 --- a/ww/buffer_pool.c +++ b/ww/buffer_pool.c @@ -15,13 +15,13 @@ #define MEMORY_PROFILE HIG2_MEMORY // todo (cmake) -#define BASE_READ_BUFSIZE (1U << 18) // 8K -#define BUFFERPOOL_CONTAINER_LEN ((16 * 4) + (16 * (1 * MEMORY_PROFILE))) +#define BASE_READ_BUFSIZE (1U << 13) // 8K +#define BUFFERPOOL_CONTAINER_LEN ((16 * 4) + (16 * (16 * MEMORY_PROFILE))) #define BUFFER_SIZE (BASE_READ_BUFSIZE * (MEMORY_PROFILE > 0 ? MEMORY_PROFILE : 1)) static void firstCharge(buffer_pool_t *pool) { - for (size_t i = 0; i < pool->cap / 2; i++) + for (size_t i = 0; i < (pool->cap / 2); i++) { pool->available[i] = newShiftBuffer(pool->buffers_size); } @@ -60,7 +60,7 @@ static void giveMemBackToOs(buffer_pool_t *pool) shift_buffer_t *popBuffer(buffer_pool_t *pool) { - return newShiftBuffer(BUFFER_SIZE); + // return newShiftBuffer(BUFFER_SIZE); if (pool->len <= 0) { reCharge(pool); @@ -76,8 +76,8 @@ shift_buffer_t *popBuffer(buffer_pool_t *pool) void reuseBuffer(buffer_pool_t *pool, shift_buffer_t *b) { - destroyShiftBuffer(b); - return; + // destroyShiftBuffer(b); + // return; if (*(b->refc) > 1) { destroyShiftBuffer(b); diff --git a/ww/eventloop/.gitattributes b/ww/eventloop/.gitattributes deleted file mode 100644 index 25128799..00000000 --- a/ww/eventloop/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -cpputil/json.hpp linguist-vendored diff --git a/ww/frand.h b/ww/frand.h index e5abf454..a44e6d6c 100644 --- a/ww/frand.h +++ b/ww/frand.h @@ -1,6 +1,6 @@ #pragma once #include "ww.h" -#include "utils/mathutils.h" // users probably want to use min/max +#include "utils/mathutils.h" // seed initialized by ww (generally time()) // Compute a pseudorandom integer.