Skip to content

Commit

Permalink
Fixed setting JSONCPP_USE_SECURE_MEMORY definition (open-source-parse…
Browse files Browse the repository at this point in the history
…rs#1479)

* Fixed setting JSONCPP_USE_SECURE_MEMORY definition

* fix indent

* Fix passing from command line

* simplified definition

---------

Co-authored-by: Jordan Bayles <[email protected]>
  • Loading branch information
TsynkPavel and baylesj authored Sep 10, 2024
1 parent 483f1c3 commit 31754ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Executable/dll output dir.")
endif()

set(JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL")
if(JSONCPP_USE_SECURE_MEMORY)
add_definitions("-DJSONCPP_USE_SECURE_MEMORY=1")
endif()

configure_file("${PROJECT_SOURCE_DIR}/version.in"
"${PROJECT_BINARY_DIR}/version"
Expand Down
5 changes: 2 additions & 3 deletions include/json/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
(JSONCPP_VERSION_PATCH << 8))

#ifdef JSONCPP_USING_SECURE_MEMORY
#undef JSONCPP_USING_SECURE_MEMORY
#endif
#if !defined(JSONCPP_USE_SECURE_MEMORY)
#define JSONCPP_USING_SECURE_MEMORY 0
#endif
// If non-zero, the library zeroes any memory that it has allocated before
// it frees its memory.

Expand Down

0 comments on commit 31754ce

Please sign in to comment.