From 7104a53332eaf21cd835f450b05771f8192ce6bc Mon Sep 17 00:00:00 2001 From: Nikita Pettik <korablev@tarantool.org> Date: Thu, 3 Jun 2021 18:22:57 +0300 Subject: [PATCH] memtx: move initialization of Small and Sys allocators to source file Let's initialize them in the dedicated allocator.cc source file Follow-up #5419 --- src/box/CMakeLists.txt | 1 + src/box/allocator.cc | 34 ++++++++++++++++++++++++++++++++++ src/box/memtx_engine.cc | 3 --- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 src/box/allocator.cc diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt index 012670818a..d07f816fe8 100644 --- a/src/box/CMakeLists.txt +++ b/src/box/CMakeLists.txt @@ -114,6 +114,7 @@ add_library(xlog STATIC xlog.c) target_link_libraries(xlog core box_error crc32 ${ZSTD_LIBRARIES}) add_library(box STATIC + allocator.cc msgpack.c iproto.cc xrow_io.cc diff --git a/src/box/allocator.cc b/src/box/allocator.cc new file mode 100644 index 0000000000..3df6adcc6c --- /dev/null +++ b/src/box/allocator.cc @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2021, Tarantool AUTHORS, please see AUTHORS file. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include "allocator.h" + +struct small_alloc SmallAlloc::small_alloc; +struct sys_alloc SysAlloc::sys_alloc; diff --git a/src/box/memtx_engine.cc b/src/box/memtx_engine.cc index 04bb830a55..638f70ab01 100644 --- a/src/box/memtx_engine.cc +++ b/src/box/memtx_engine.cc @@ -58,9 +58,6 @@ /* sync snapshot every 16MB */ #define SNAP_SYNC_INTERVAL (1 << 24) -struct small_alloc SmallAlloc::small_alloc; -struct sys_alloc SysAlloc::sys_alloc; - static void checkpoint_cancel(struct checkpoint *ckpt); -- GitLab