From 7ef6e580247a3970560603c3b89a45b18bb87b9e Mon Sep 17 00:00:00 2001 From: Tom Ritchford Date: Fri, 26 Jun 2015 15:51:10 -0400 Subject: [PATCH] Tidy Json: * Remove unused code. * Rename .inl file to .cpp. * Remove duplicate macros. --- Builds/VisualStudio2013/RippleD.vcxproj | 6 ++- .../VisualStudio2013/RippleD.vcxproj.filters | 4 +- src/ripple/json/impl/json_value.cpp | 40 ------------------- ...lueiterator.inl => json_valueiterator.cpp} | 6 ++- src/ripple/unity/json.cpp | 8 +--- 5 files changed, 12 insertions(+), 52 deletions(-) rename src/ripple/json/impl/{json_valueiterator.inl => json_valueiterator.cpp} (98%) diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index 8c8805f586..669533588e 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -2205,8 +2205,10 @@ True True - - + + True + True + True True diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index 830934dd34..bb2a49d0f4 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -2913,9 +2913,9 @@ ripple\json\impl - + ripple\json\impl - + ripple\json\impl diff --git a/src/ripple/json/impl/json_value.cpp b/src/ripple/json/impl/json_value.cpp index c580838295..a72ae7d66d 100644 --- a/src/ripple/json/impl/json_value.cpp +++ b/src/ripple/json/impl/json_value.cpp @@ -30,34 +30,6 @@ const Int Value::minInt = Int ( ~ (UInt (-1) / 2) ); const Int Value::maxInt = Int ( UInt (-1) / 2 ); const UInt Value::maxUInt = UInt (-1); -// A "safe" implementation of strdup. Allow null pointer to be passed. -// Also avoid warning on msvc80. -// -//inline char *safeStringDup( const char *czstring ) -//{ -// if ( czstring ) -// { -// const size_t length = (unsigned int)( strlen(czstring) + 1 ); -// char *newString = static_cast( malloc( length ) ); -// memcpy( newString, czstring, length ); -// return newString; -// } -// return 0; -//} -// -//inline char *safeStringDup( std::string const&str ) -//{ -// if ( !str.empty() ) -// { -// const size_t length = str.length(); -// char *newString = static_cast( malloc( length + 1 ) ); -// memcpy( newString, str.c_str(), length ); -// newString[length] = 0; -// return newString; -// } -// return 0; -//} - ValueAllocator::~ValueAllocator () { } @@ -116,18 +88,6 @@ static struct DummyValueAllocatorInitializer } } dummyValueAllocatorInitializer; - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ValueInternals... -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -# include - - // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// diff --git a/src/ripple/json/impl/json_valueiterator.inl b/src/ripple/json/impl/json_valueiterator.cpp similarity index 98% rename from src/ripple/json/impl/json_valueiterator.inl rename to src/ripple/json/impl/json_valueiterator.cpp index a4c45e4430..8b94182a02 100644 --- a/src/ripple/json/impl/json_valueiterator.inl +++ b/src/ripple/json/impl/json_valueiterator.cpp @@ -18,8 +18,10 @@ //============================================================================== // included by json_value.cpp -// everything is within Json namespace +#include + +namespace Json { // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// @@ -206,3 +208,5 @@ ValueIterator::operator = ( const SelfType& other ) copy ( other ); return *this; } + +} // Json diff --git a/src/ripple/unity/json.cpp b/src/ripple/unity/json.cpp index 9908d89d1e..5dad5c76f1 100644 --- a/src/ripple/unity/json.cpp +++ b/src/ripple/unity/json.cpp @@ -25,15 +25,9 @@ #include #include -// For json/ -// - -#define JSON_ASSERT_UNREACHABLE assert( false ) -#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw -#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message ); - #include #include +#include #include #include