Skip to content

Commit

Permalink
Merge pull request #296 from LLNL/hotfix/json
Browse files Browse the repository at this point in the history
Hotfix/json
  • Loading branch information
KIwabuchi authored Nov 1, 2023
2 parents a2225e5 + 47f5015 commit 8db3cef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/metall/json/key_value_pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ template <typename char_type, typename char_traits, typename allocator_type,
inline bool general_key_value_pair_equal(
const key_value_pair<char_type, char_traits, allocator_type> &key_value,
const other_key_value_pair_type &other_key_value) noexcept {
if (std::strcmp(key_value.c_str(), other_key_value.c_str()) != 0)
if (key_value.key().length() != other_key_value.key().length())
return false;
if (std::strcmp(key_value.key_c_str(), other_key_value.key_c_str()) != 0)
return false;
return key_value.value() == other_key_value.value();
}
Expand Down Expand Up @@ -100,8 +102,10 @@ class key_value_pair {
m_short_key_buf = other.m_short_key_buf;
} else {
m_long_key = std::move(other.m_long_key);
other.m_long_key = nullptr;
}
m_key_length = other.m_key_length;
other.m_key_length = 0;
}

/// \brief Allocator-extended move constructor
Expand All @@ -112,6 +116,7 @@ class key_value_pair {
m_short_key_buf = other.m_short_key_buf;
} else {
m_long_key = std::move(other.m_long_key);
other.m_long_key = nullptr;
}
m_key_length = other.m_key_length;
other.m_key_length = 0;
Expand Down Expand Up @@ -151,6 +156,7 @@ class key_value_pair {
m_short_key_buf = other.m_short_key_buf;
} else {
m_long_key = std::move(other.m_long_key);
other.m_long_key = nullptr;
}
m_key_length = other.m_key_length;
other.m_key_length = 0;
Expand Down

0 comments on commit 8db3cef

Please sign in to comment.