Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ include(cmake/Installation.cmake)
if(STRING_LENGTH)
if(STRING_LENGTH GREATER_EQUAL 100)
message(STATUS "Max calliper label length is ${STRING_LENGTH}")
target_compile_definitions(${CMAKE_PROJECT_NAME} INTERFACE
PROF_STRING_BUFFER_LENGTH=${STRING_LENGTH})
target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC
"PROF_STRING_BUFFER_LENGTH=${STRING_LENGTH}")
else()
message(WARNING "Max calliper label length is too small - using 100")
endif()
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
| andrewcoughtrie | Andrew Coughtrie | Met Office | 2026-03-05 |
| mo-marqh | mark Hedley | Met Office | 2026-03-10 |
| oakleybrunt | Oakley Brunt | Met Office | 2026-03-09 |
| EdHone | Ed Hone | Met Office | 2026-03-20 |
| EdHone | Ed Hone | Met Office | 2026-03-20 |
| t00sa | Sam Clarke-Green | Met Office | 2026-03-26 |
7 changes: 6 additions & 1 deletion src/c++/hashtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cstddef>
#include <cstring>
#include <iterator>
#include <sstream>

/**
* @brief Hashtable constructor
Expand Down Expand Up @@ -68,7 +69,11 @@ size_t meto::HashTable::compute_hash(std::string_view region_name, int tid) {
new_chars.fill('\0');

if (region_name.length() + num_extra_bytes > new_chars.size()) {
error_handler("Internal error: character buffer exhausted.", EXIT_FAILURE);
std::stringstream message;
message << "Vernier internal error: region name too long ("
<< region_name.length() << " > "
<< new_chars.size() - num_extra_bytes << ")";
error_handler(message.str(), EXIT_FAILURE);
}

// Get iterator to the start of the string buffer.
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/c++/test_hashtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using ::testing::AllOf;
using ::testing::An;
using ::testing::Gt;
using ::testing::HasSubstr;

int const tid = 0;
std::string tid_str(std::to_string(tid));
Expand Down Expand Up @@ -127,7 +128,7 @@ TEST(HashTableTest, NameLengthTest) {
meto::vernier.init();

EXPECT_EXIT(meto::vernier.start(label), testing::ExitedWithCode(1),
"Internal error: character buffer exhausted.");
HasSubstr("Vernier internal error: region name too long"));

meto::vernier.finalize();
}
Loading