mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-19 19:39:26 +08:00
mdbx: изменение лицензии и реструктуризация исходного кода.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
## Copyright (c) 2020-2024 Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru>
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
enable_language(CXX)
|
||||
include(../cmake/compiler.cmake)
|
||||
|
||||
@@ -37,6 +40,7 @@ if(NOT MDBX_BUILD_CXX)
|
||||
endif()
|
||||
|
||||
add_executable(mdbx_test ${LIBMDBX_TEST_SOURCES})
|
||||
target_compile_definitions(mdbx_test PRIVATE MDBX_BUILD_TEST=1 MDBX_BUILD_CXX=1)
|
||||
|
||||
if(MDBX_CXX_STANDARD)
|
||||
set_target_properties(mdbx_test PROPERTIES
|
||||
@@ -47,6 +51,13 @@ set_target_properties(mdbx_test PROPERTIES
|
||||
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
|
||||
target_setup_options(mdbx_test)
|
||||
|
||||
if(NOT MDBX_BUILD_CXX)
|
||||
target_compile_definitions(mdbx_test PRIVATE MDBX_BUILD_CXX=1)
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_compile_definitions(mdbx_test PRIVATE MDBX_WITHOUT_MSVC_CRT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM)
|
||||
if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23
|
||||
AND NOT CMAKE_VERSION VERSION_LESS 3.13)
|
||||
@@ -73,9 +84,9 @@ if(UNIX AND NOT SUBPROJECT)
|
||||
target_include_directories(test_extra_upsert_alldups PRIVATE "${PROJECT_SOURCE_DIR}")
|
||||
target_link_libraries(test_extra_upsert_alldups ${TOOL_MDBX_LIB})
|
||||
|
||||
add_executable(test_extra_dupfixed_addodd extra/dupfixed_addodd.c)
|
||||
target_include_directories(test_extra_dupfixed_addodd PRIVATE "${PROJECT_SOURCE_DIR}")
|
||||
target_link_libraries(test_extra_dupfixed_addodd ${TOOL_MDBX_LIB})
|
||||
add_executable(test_extra_dupfix_addodd extra/dupfix_addodd.c)
|
||||
target_include_directories(test_extra_dupfix_addodd PRIVATE "${PROJECT_SOURCE_DIR}")
|
||||
target_link_libraries(test_extra_dupfix_addodd ${TOOL_MDBX_LIB})
|
||||
|
||||
if(MDBX_BUILD_CXX)
|
||||
add_executable(test_extra_maindb_ordinal extra/maindb_ordinal.c++)
|
||||
@@ -85,11 +96,11 @@ if(UNIX AND NOT SUBPROJECT)
|
||||
set_target_properties(test_extra_maindb_ordinal PROPERTIES
|
||||
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
add_executable(test_extra_dupfixed_multiple extra/dupfixed_multiple.c++)
|
||||
target_include_directories(test_extra_dupfixed_multiple PRIVATE "${PROJECT_SOURCE_DIR}")
|
||||
target_link_libraries(test_extra_dupfixed_multiple ${TOOL_MDBX_LIB})
|
||||
add_executable(test_extra_dupfix_multiple extra/dupfix_multiple.c++)
|
||||
target_include_directories(test_extra_dupfix_multiple PRIVATE "${PROJECT_SOURCE_DIR}")
|
||||
target_link_libraries(test_extra_dupfix_multiple ${TOOL_MDBX_LIB})
|
||||
if(MDBX_CXX_STANDARD)
|
||||
set_target_properties(test_extra_dupfixed_multiple PROPERTIES
|
||||
set_target_properties(test_extra_dupfix_multiple PROPERTIES
|
||||
CXX_STANDARD ${MDBX_CXX_STANDARD} CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
add_executable(test_extra_hex_base64_base58 extra/hex_base64_base58.c++)
|
||||
@@ -187,10 +198,10 @@ else()
|
||||
|
||||
if(UNIX AND NOT SUBPROJECT)
|
||||
add_test(NAME extra_upsert_alldups COMMAND test_extra_upsert_alldups)
|
||||
add_test(NAME extra_dupfixed_addodd COMMAND test_extra_dupfixed_addodd)
|
||||
add_test(NAME extra_dupfix_addodd COMMAND test_extra_dupfix_addodd)
|
||||
if(MDBX_BUILD_CXX)
|
||||
add_test(NAME extra_maindb_ordinal COMMAND test_extra_maindb_ordinal)
|
||||
add_test(NAME extra_dupfixed_multiple COMMAND test_extra_dupfixed_multiple)
|
||||
add_test(NAME extra_dupfix_multiple COMMAND test_extra_dupfix_multiple)
|
||||
add_test(NAME extra_hex_base64_base58 COMMAND test_extra_hex_base64_base58)
|
||||
add_test(NAME extra_doubtless_positioning COMMAND test_extra_doubtless_positioning)
|
||||
if (ENABLE_MEMCHECK)
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,42 +1,11 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include "../src/essentials.h"
|
||||
|
||||
/* Workaround for modern libstdc++ with CLANG < 4.x */
|
||||
#if defined(__SIZEOF_INT128__) && !defined(__GLIBCXX_TYPE_INT_N_0) && \
|
||||
defined(__clang__) && __clang_major__ < 4
|
||||
#define __GLIBCXX_BITSIZE_INT_N_0 128
|
||||
#define __GLIBCXX_TYPE_INT_N_0 __int128
|
||||
#endif /* Workaround for modern libstdc++ with CLANG < 4.x */
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS)
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0601 /* Windows 7 */
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
/* Workaround for MSVC' header `extern "C"` vs `std::` redefinition bug */
|
||||
#if defined(__SANITIZE_ADDRESS__) && !defined(_DISABLE_VECTOR_ANNOTATION)
|
||||
#define _DISABLE_VECTOR_ANNOTATION
|
||||
#endif /* _DISABLE_VECTOR_ANNOTATION */
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif /* _CRT_SECURE_NO_WARNINGS */
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable : 4548) /* expression before comma has no effect; \
|
||||
expected expression with side - effect */
|
||||
@@ -47,6 +16,7 @@
|
||||
is not guaranteed. Specify /EHsc */
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS)
|
||||
/* If you wish to build your application for a previous Windows platform,
|
||||
* include WinSDKVer.h and set the _WIN32_WINNT macro to the platform you
|
||||
* wish to support before including SDKDDKVer.h.
|
||||
@@ -55,10 +25,6 @@
|
||||
#include <SDKDDKVer.h>
|
||||
#endif /* WINDOWS */
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
@@ -96,18 +62,11 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#define MDBX_INTERNAL_FUNC
|
||||
#define MDBX_INTERNAL_VAR_PROTO extern
|
||||
#define MDBX_INTERNAL_VAR_INSTA
|
||||
#define MDBX_INTERNAL
|
||||
#define xMDBX_TOOLS /* Avoid using internal eASSERT() */
|
||||
#include "../mdbx.h++"
|
||||
#include "../src/base.h"
|
||||
#include "../src/osal.h"
|
||||
|
||||
#if !defined(__thread) && (defined(_MSC_VER) || defined(__DMC__))
|
||||
#define __thread __declspec(thread)
|
||||
#endif /* __thread */
|
||||
|
||||
#include "../src/options.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
class testcase_copy : public testcase {
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "mdbx.h++"
|
||||
#include <array>
|
||||
#include <functional>
|
||||
|
@@ -1,3 +1,6 @@
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "mdbx.h++"
|
||||
#include <array>
|
||||
#include <iostream>
|
@@ -1,3 +1,6 @@
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "mdbx.h++"
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
|
@@ -1,3 +1,6 @@
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "mdbx.h++"
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2023 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
15
test/log.c++
15
test/log.c++
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
16
test/log.h++
16
test/log.h++
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -101,6 +90,7 @@ void log_trouble(const char *where, const char *what, int errnum);
|
||||
void log_flush(void);
|
||||
bool log_enabled(const logging::loglevel priority);
|
||||
|
||||
#undef TRACE
|
||||
#ifdef _DEBUG
|
||||
#define TRACE(...) log_trace(__VA_ARGS__)
|
||||
#else
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
LIST=basic
|
||||
FROM=1
|
||||
UPTO=9999999
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
#include <cmath>
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
@@ -51,11 +40,11 @@
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include <atomic>
|
||||
MDBX_MAYBE_UNUSED static __inline int atomic_decrement(std::atomic_int *p) {
|
||||
MDBX_MAYBE_UNUSED static inline int atomic_decrement(std::atomic_int *p) {
|
||||
return std::atomic_fetch_sub(p, 1) - 1;
|
||||
}
|
||||
#else
|
||||
MDBX_MAYBE_UNUSED static __inline int atomic_decrement(volatile int *p) {
|
||||
MDBX_MAYBE_UNUSED static inline int atomic_decrement(volatile int *p) {
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
return __sync_sub_and_fetch(p, 1);
|
||||
#elif defined(_MSC_VER)
|
||||
@@ -351,8 +340,6 @@ static void handler_SIGCHLD(int signum) {
|
||||
++sigalarm_head;
|
||||
}
|
||||
|
||||
mdbx_pid_t osal_getpid(void) { return getpid(); }
|
||||
|
||||
int osal_delay(unsigned seconds) { return sleep(seconds) ? errno : 0; }
|
||||
|
||||
int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
@@ -112,8 +101,6 @@ int osal_waitfor(unsigned id) {
|
||||
return waitstatus2errcode(rc);
|
||||
}
|
||||
|
||||
mdbx_pid_t osal_getpid(void) { return GetCurrentProcessId(); }
|
||||
|
||||
int osal_delay(unsigned seconds) {
|
||||
Sleep(seconds * 1000u);
|
||||
return 0;
|
||||
@@ -300,7 +287,7 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
|
||||
failure_perror("QueryFullProcessImageName()", GetLastError());
|
||||
|
||||
if (exename[1] != ':') {
|
||||
exename_size = GetModuleFileName(NULL, exename, sizeof(exename));
|
||||
exename_size = GetModuleFileNameA(NULL, exename, sizeof(exename));
|
||||
if (exename_size >= sizeof(exename))
|
||||
return ERROR_BAD_LENGTH;
|
||||
}
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -28,7 +17,6 @@ void osal_wait4barrier(void);
|
||||
|
||||
bool osal_progress_push(bool active);
|
||||
|
||||
mdbx_pid_t osal_getpid(void);
|
||||
int osal_delay(unsigned seconds);
|
||||
void osal_udelay(size_t us);
|
||||
void osal_yield(void);
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
LIST=--hill
|
||||
FROM=1
|
||||
UPTO=9999999
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
@@ -802,15 +791,7 @@ void testcase::speculum_check_cursor(const char *where, const char *stage,
|
||||
const MDBX_cursor_op op) const {
|
||||
MDBX_val cursor_key = {0, 0};
|
||||
MDBX_val cursor_data = {0, 0};
|
||||
int err;
|
||||
if (it != speculum.end() && std::next(it) == speculum.end() &&
|
||||
op == MDBX_PREV && (config.params.table_flags & MDBX_DUPSORT)) {
|
||||
/* Workaround for MDBX/LMDB flaw */
|
||||
err = mdbx_cursor_get(cursor, &cursor_key, &cursor_data, MDBX_LAST);
|
||||
if (err == MDBX_SUCCESS)
|
||||
err = mdbx_cursor_get(cursor, &cursor_key, &cursor_data, MDBX_LAST_DUP);
|
||||
} else
|
||||
err = mdbx_cursor_get(cursor, &cursor_key, &cursor_data, op);
|
||||
int err = mdbx_cursor_get(cursor, &cursor_key, &cursor_data, op);
|
||||
return speculum_check_cursor(where, stage, it, err, cursor_key, cursor_data);
|
||||
}
|
||||
|
||||
@@ -1265,14 +1246,14 @@ bool testcase::check_batch_get() {
|
||||
bool rc = true;
|
||||
MDBX_val pairs[42];
|
||||
size_t count = 0xDeadBeef;
|
||||
MDBX_cursor_op batch_op;
|
||||
batch_err = mdbx_cursor_get_batch(batch_cursor, &count, pairs,
|
||||
ARRAY_LENGTH(pairs), batch_op = MDBX_FIRST);
|
||||
ARRAY_LENGTH(pairs), MDBX_FIRST);
|
||||
size_t i, n = 0;
|
||||
while (batch_err == MDBX_SUCCESS || batch_err == MDBX_RESULT_TRUE) {
|
||||
for (i = 0; i < count; i += 2) {
|
||||
mdbx::slice k, v;
|
||||
check_err = mdbx_cursor_get(check_cursor, &k, &v, MDBX_NEXT);
|
||||
check_err =
|
||||
mdbx_cursor_get(check_cursor, &k, &v, n ? MDBX_NEXT : MDBX_FIRST);
|
||||
if (check_err != MDBX_SUCCESS)
|
||||
failure_perror("batch-verify: mdbx_cursor_get(MDBX_NEXT)", check_err);
|
||||
if (k != pairs[i] || v != pairs[i + 1]) {
|
||||
@@ -1286,14 +1267,13 @@ bool testcase::check_batch_get() {
|
||||
sizeof(dump_value_batch)));
|
||||
rc = false;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
n += i / 2;
|
||||
batch_op = (batch_err == MDBX_RESULT_TRUE) ? MDBX_GET_CURRENT : MDBX_NEXT;
|
||||
batch_err = mdbx_cursor_get_batch(batch_cursor, &count, pairs,
|
||||
ARRAY_LENGTH(pairs), batch_op);
|
||||
ARRAY_LENGTH(pairs), MDBX_NEXT);
|
||||
}
|
||||
if (batch_err != MDBX_NOTFOUND) {
|
||||
log_error("mdbx_cursor_get_batch(), op %u, err %d", batch_op, batch_err);
|
||||
log_error("mdbx_cursor_get_batch(), err %d", batch_err);
|
||||
rc = false;
|
||||
}
|
||||
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
|
||||
class testcase_try : public testcase {
|
||||
|
15
test/ttl.c++
15
test/ttl.c++
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
#include <cmath>
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "test.h++"
|
||||
#include <float.h>
|
||||
|
@@ -1,16 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2024 Leonid Yuriev <leo@yuriev.ru>
|
||||
* and other libmdbx authors: please see AUTHORS file.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted only as authorized by the OpenLDAP
|
||||
* Public License.
|
||||
*
|
||||
* A copy of this license is available in the file LICENSE in the
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
/// \author Леонид Юрьев aka Leonid Yuriev <leo@yuriev.ru> \date 2015-2024
|
||||
/// \copyright SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
#include "base.h++"
|
||||
@@ -41,7 +30,7 @@
|
||||
|
||||
#if _MSC_FULL_VER < 190024215
|
||||
#pragma message( \
|
||||
"It is recommended to use Visual Studio 2015 (MSC 19.0) or newer.")
|
||||
"It is recommended to use Visual Studio 2015 (MSC 19.0) or newer.")
|
||||
#endif
|
||||
|
||||
#define bswap64(v) _byteswap_uint64(v)
|
||||
@@ -70,7 +59,7 @@
|
||||
#ifdef __bswap_64
|
||||
#define bswap64(v) __bswap_64(v)
|
||||
#else
|
||||
static __inline uint64_t bswap64(uint64_t v) {
|
||||
static inline uint64_t bswap64(uint64_t v) {
|
||||
return v << 56 | v >> 56 | ((v << 40) & UINT64_C(0x00ff000000000000)) |
|
||||
((v << 24) & UINT64_C(0x0000ff0000000000)) |
|
||||
((v << 8) & UINT64_C(0x000000ff00000000)) |
|
||||
@@ -85,7 +74,7 @@ static __inline uint64_t bswap64(uint64_t v) {
|
||||
#ifdef __bswap_32
|
||||
#define bswap32(v) __bswap_32(v)
|
||||
#else
|
||||
static __inline uint32_t bswap32(uint32_t v) {
|
||||
static inline uint32_t bswap32(uint32_t v) {
|
||||
return v << 24 | v >> 24 | ((v << 8) & UINT32_C(0x00ff0000)) |
|
||||
((v >> 8) & UINT32_C(0x0000ff00));
|
||||
}
|
||||
@@ -96,7 +85,7 @@ static __inline uint32_t bswap32(uint32_t v) {
|
||||
#ifdef __bswap_16
|
||||
#define bswap16(v) __bswap_16(v)
|
||||
#else
|
||||
static __inline uint16_t bswap16(uint16_t v) { return v << 8 | v >> 8; }
|
||||
static inline uint16_t bswap16(uint16_t v) { return v << 8 | v >> 8; }
|
||||
#endif
|
||||
#endif /* bswap16 */
|
||||
|
||||
@@ -147,7 +136,7 @@ static __inline uint16_t bswap16(uint16_t v) { return v << 8 | v >> 8; }
|
||||
|
||||
namespace unaligned {
|
||||
|
||||
template <typename T> static __inline T load(const void *ptr) {
|
||||
template <typename T> static inline T load(const void *ptr) {
|
||||
if (MDBX_UNALIGNED_OK >= sizeof(T))
|
||||
return *(const T *)ptr;
|
||||
else {
|
||||
@@ -162,7 +151,7 @@ template <typename T> static __inline T load(const void *ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> static __inline void store(void *ptr, const T &value) {
|
||||
template <typename T> static inline void store(void *ptr, const T &value) {
|
||||
if (MDBX_UNALIGNED_OK >= sizeof(T))
|
||||
*(T *)ptr = value;
|
||||
else {
|
||||
@@ -180,22 +169,22 @@ template <typename T> static __inline void store(void *ptr, const T &value) {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef rot64
|
||||
static __inline uint64_t rot64(uint64_t v, unsigned s) {
|
||||
static inline uint64_t rot64(uint64_t v, unsigned s) {
|
||||
return (v >> s) | (v << (64 - s));
|
||||
}
|
||||
#endif /* rot64 */
|
||||
|
||||
static __inline bool is_power2(size_t x) { return (x & (x - 1)) == 0; }
|
||||
static inline bool is_power2(size_t x) { return (x & (x - 1)) == 0; }
|
||||
|
||||
#undef roundup2
|
||||
static __inline size_t roundup2(size_t value, size_t granularity) {
|
||||
static inline size_t roundup2(size_t value, size_t granularity) {
|
||||
assert(is_power2(granularity));
|
||||
return (value + granularity - 1) & ~(granularity - 1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static __inline void memory_barrier(void) {
|
||||
static inline void memory_barrier(void) {
|
||||
#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
|
||||
__c11_atomic_thread_fence(__ATOMIC_SEQ_CST);
|
||||
#elif defined(__ATOMIC_SEQ_CST)
|
||||
@@ -225,7 +214,7 @@ static __inline void memory_barrier(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline void cpu_relax() {
|
||||
static inline void cpu_relax() {
|
||||
#if defined(__ia32__)
|
||||
_mm_pause();
|
||||
#elif defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS) || \
|
||||
|
@@ -3,7 +3,7 @@
|
||||
Memcheck:Param
|
||||
msync(start)
|
||||
...
|
||||
fun:sync_locked*
|
||||
fun:dxb_sync_locked*
|
||||
}
|
||||
{
|
||||
msync-whole-mmap-2
|
||||
@@ -24,7 +24,7 @@
|
||||
Memcheck:Param
|
||||
msync(start)
|
||||
...
|
||||
fun:wipe_steady*
|
||||
fun:meta_wipe_steady*
|
||||
}
|
||||
{
|
||||
msync-meta
|
||||
|
Reference in New Issue
Block a user