summaryrefslogtreecommitdiff
path: root/scripting/utils.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-03-17 00:07:52 +0100
committerAntonin Kral <a.kral@bobek.cz>2011-03-17 00:07:52 +0100
commit98b8b639326ab4c89eed73739d9903993c4c8959 (patch)
tree0462df078bf740093774d033b75f0ea24a31fa97 /scripting/utils.cpp
parentf5d6e97ca8d2f3e7c4cdd5c9afbf8e756ef65bc2 (diff)
parent582fc32574a3b158c81e49cb00e6ae59205e66ba (diff)
downloadmongodb-98b8b639326ab4c89eed73739d9903993c4c8959.tar.gz
Merge commit 'upstream/1.8.0
Diffstat (limited to 'scripting/utils.cpp')
-rw-r--r--scripting/utils.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/scripting/utils.cpp b/scripting/utils.cpp
index ee01bb2..97eea10 100644
--- a/scripting/utils.cpp
+++ b/scripting/utils.cpp
@@ -23,31 +23,40 @@
namespace mongo {
- BSONObj jsmd5( const BSONObj &a ){
+ void installBenchmarkSystem( Scope& scope );
+
+ BSONObj jsmd5( const BSONObj &a ) {
uassert( 10261 , "js md5 needs a string" , a.firstElement().type() == String );
const char * s = a.firstElement().valuestrsafe();
-
+
md5digest d;
md5_state_t st;
md5_init(&st);
md5_append( &st , (const md5_byte_t*)s , strlen( s ) );
md5_finish(&st, d);
-
+
return BSON( "" << digestToString( d ) );
}
-
- BSONObj JSVersion( const BSONObj& args ){
+
+ BSONObj JSVersion( const BSONObj& args ) {
cout << "version: " << versionString << endl;
if ( strstr( versionString , "+" ) )
printGitVersion();
return BSONObj();
}
- void installGlobalUtils( Scope& scope ){
+
+ // ---------------------------------
+ // ---- installer --------
+ // ---------------------------------
+
+ void installGlobalUtils( Scope& scope ) {
scope.injectNative( "hex_md5" , jsmd5 );
scope.injectNative( "version" , JSVersion );
+
+ installBenchmarkSystem( scope );
}
}
-
+