mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-05-17 19:31:35 +02:00
Got rid of several unnecessary includes of <iostream>.
Including <iostream> causes the file to be polluted with a static initializer for the __ioinit symbol. This can harm binary startup time. For more info, see here: http://neugierig.org/software/chromium/notes/2011/08/static-initializers.html
This commit is contained in:
parent
7c507d7eba
commit
2b853c4067
@ -7,7 +7,6 @@
|
|||||||
# define CPPTL_JSON_ASSERTIONS_H_INCLUDED
|
# define CPPTL_JSON_ASSERTIONS_H_INCLUDED
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#if !defined(JSON_IS_AMALGAMATION)
|
#if !defined(JSON_IS_AMALGAMATION)
|
||||||
# include <json/config.h>
|
# include <json/config.h>
|
||||||
@ -18,7 +17,13 @@
|
|||||||
#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message );
|
#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message );
|
||||||
#else // JSON_USE_EXCEPTION
|
#else // JSON_USE_EXCEPTION
|
||||||
#define JSON_ASSERT( condition ) assert( condition );
|
#define JSON_ASSERT( condition ) assert( condition );
|
||||||
#define JSON_FAIL_MESSAGE( message ) { std::cerr << std::endl << message << std::endl; exit(123); }
|
|
||||||
|
// The call to assert() will show the failure message in debug builds. In
|
||||||
|
// release bugs we write to invalid memory in order to crash hard instead of
|
||||||
|
// calling exit(), so that a debugger or crash reporter gets the chance to take
|
||||||
|
// over.
|
||||||
|
#define JSON_FAIL_MESSAGE( message ) { assert(false && message); strcpy(reinterpret_cast<char*>(666), message); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) { JSON_FAIL_MESSAGE( message ) }
|
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) { JSON_FAIL_MESSAGE( message ) }
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
# include <deque>
|
# include <deque>
|
||||||
# include <stack>
|
# include <stack>
|
||||||
# include <string>
|
# include <string>
|
||||||
# include <iostream>
|
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
# include <vector>
|
# include <vector>
|
||||||
# include <string>
|
# include <string>
|
||||||
# include <iostream>
|
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#if _MSC_VER >= 1400 // VC++ 8.0
|
#if _MSC_VER >= 1400 // VC++ 8.0
|
||||||
@ -904,7 +903,14 @@ std::istream& operator>>( std::istream &sin, Value &root )
|
|||||||
{
|
{
|
||||||
Json::Reader reader;
|
Json::Reader reader;
|
||||||
bool ok = reader.parse(sin, root, true);
|
bool ok = reader.parse(sin, root, true);
|
||||||
if (!ok) JSON_FAIL_MESSAGE(reader.getFormattedErrorMessages());
|
if (!ok) {
|
||||||
|
fprintf(
|
||||||
|
stderr,
|
||||||
|
"Error from reader: %s",
|
||||||
|
reader.getFormattedErrorMessages().c_str());
|
||||||
|
|
||||||
|
JSON_FAIL_MESSAGE("reader error");
|
||||||
|
}
|
||||||
return sin;
|
return sin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
# endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
|
# endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
|
||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user