diff --git a/src/3rdparty b/src/3rdparty index c1eab215ae..1030737715 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit c1eab215ae34b2bc03fcb8c787b386a25e00bf3e +Subproject commit 10307377157d71c0ad0d3fd33ccf7e04ce8f65ff diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f2009c536f..564fd7acb3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -441,12 +441,17 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ ) install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/fifo_map.hpp ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/json.hpp ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h DESTINATION include/zeek/3rdparty ) +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tsl-ordered-map/ordered_map.h + ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tsl-ordered-map/ordered_hash.h + DESTINATION include/zeek/3rdparty/tsl-ordered-map +) + ######################################################################## ## Clang-tidy target now that we have all of the sources diff --git a/src/Val.cc b/src/Val.cc index 6a27dbfbc7..2da784de9b 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -28,14 +28,19 @@ #include "broker/Data.h" #include "3rdparty/json.hpp" -#include "3rdparty/fifo_map.hpp" +#include "3rdparty/tsl-ordered-map/ordered_map.h" + // Define a class for use with the json library that orders the keys in the same order that // they were inserted. By default, the json library orders them alphabetically and we don't // want it like that. -template -using json_fifo_map = nlohmann::fifo_map, A>; -using ZeekJson = nlohmann::basic_json; +template, class KeyEqual = std::equal_to, + class AllocatorPair = typename std::allocator_traits::template rebind_alloc>, + class ValueTypeContainer = std::vector, AllocatorPair>> +using ordered_map = tsl::ordered_map; + +using ZeekJson = nlohmann::basic_json; Val::Val(Func* f) { diff --git a/src/threading/formatters/JSON.h b/src/threading/formatters/JSON.h index 1015eb54c6..71edadc61d 100644 --- a/src/threading/formatters/JSON.h +++ b/src/threading/formatters/JSON.h @@ -4,7 +4,7 @@ #include "../Formatter.h" #include "3rdparty/json.hpp" -#include "3rdparty/fifo_map.hpp" +#include "3rdparty/tsl-ordered-map/ordered_map.h" namespace threading { namespace formatter { @@ -12,9 +12,13 @@ namespace threading { namespace formatter { // Define a class for use with the json library that orders the keys in the same order that // they were inserted. By default, the json library orders them alphabetically and we don't // want it like that. -template -using json_fifo_map = nlohmann::fifo_map, A>; -using ZeekJson = nlohmann::basic_json; +template, class KeyEqual = std::equal_to, + class AllocatorPair = typename std::allocator_traits::template rebind_alloc>, + class ValueTypeContainer = std::vector, AllocatorPair>> +using ordered_map = tsl::ordered_map; + +using ZeekJson = nlohmann::basic_json; /** * A thread-safe class for converting values into a JSON representation