summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-06-04 16:46:26 -0400
committerMathias Stearn <mathias@10gen.com>2010-06-14 08:25:25 -0400
commit493cc2654c214b940072c2c54f663b1be7f2e44c (patch)
tree3c50fbf61ee714ec8b0bf53277a642b7389b5d08
parent1248f119bd4dfcd2aeaba3e510f91f065bf576ba (diff)
downloadmongo-493cc2654c214b940072c2c54f663b1be7f2e44c.tar.gz
more JSON speedup
-rw-r--r--db/json.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/db/json.cpp b/db/json.cpp
index a5e0bd41ce0..77983c39c36 100644
--- a/db/json.cpp
+++ b/db/json.cpp
@@ -558,18 +558,14 @@ public:
};
BSONObj fromjson( const char *str ) {
- if ( ! strlen(str) )
+ if ( str[0] == '\0' )
return BSONObj();
ObjectBuilder b;
JsonGrammar parser( b );
parse_info<> result = parse( str, parser, space_p );
if ( !result.full ) {
- int len = strlen( result.stop );
- if ( len > 10 )
- len = 10;
- stringstream ss;
- ss << "Failure parsing JSON string near: " << string( result.stop, len );
- massert( 10340 , ss.str(), false );
+ int len = strnlen(result.stop , 10);
+ massert( 10340 , "Failure parsing JSON string near: " + string( result.stop, len ) , false );
}
BSONObj ret = b.pop();
assert( b.empty() );
@@ -580,4 +576,8 @@ public:
return fromjson( str.c_str() );
}
+ BSONObj fromjson( istream &str ) {
+ return BSONObj();
+ }
+
} // namespace mongo