Skip to content

Do not reference SecureAllocator when not JSONCPP_USING_SECURE_MEMORY #872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 6 additions & 3 deletions include/json/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,13 @@ typedef UInt64 LargestUInt;
#define JSON_HAS_INT64
#endif // if defined(JSON_NO_INT64)

#if JSONCPP_USING_SECURE_MEMORY
template <typename T>
using Allocator = typename std::conditional<JSONCPP_USING_SECURE_MEMORY,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should still have a Json::Allocator alias template.
If there's fancy conditional or #if tap dancing to calculate the Allocator alias, let's have it contained to the Allocator declaration and not infect things like Json::String. The definition of Json::String should just use Json::Allocator unconditionally.

SecureAllocator<T>,
std::allocator<T>>::type;
using Allocator = SecureAllocator<T>;
#else // !JSONCPP_USING_SECURE_MEMORY
template <typename T>
using Allocator = std::allocator<T>;
#endif // JSONCPP_USING_SECURE_MEMORY
using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
using IStringStream = std::basic_istringstream<String::value_type,
String::traits_type,
Expand Down