summaryrefslogtreecommitdiff
path: root/src/mongo/db/restapi.cpp
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2012-08-02 05:55:24 -0400
committerTad Marshall <tad@10gen.com>2012-08-31 11:44:37 -0400
commit15624a7a7e60ce1f50fc50f6cba54398b2af17d2 (patch)
treea6f830ee48e31ad7a0a69bd13fe97fa42c16b94e /src/mongo/db/restapi.cpp
parent1f8725142aee6cd4598ff360f638055e44557bec (diff)
downloadmongo-15624a7a7e60ce1f50fc50f6cba54398b2af17d2.tar.gz
SERVER-6908 Don't pass strings by value
Change lots of code to take <string> arguments by const ref instead of by value; minor changes to surrounding code.
Diffstat (limited to 'src/mongo/db/restapi.cpp')
-rw-r--r--src/mongo/db/restapi.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp
index 0f982b5fda8..da9a3fe48ef 100644
--- a/src/mongo/db/restapi.cpp
+++ b/src/mongo/db/restapi.cpp
@@ -49,7 +49,7 @@ namespace mongo {
url.find_last_of( '/' ) > 0;
}
- virtual void handle( const char *rq, string url, BSONObj params,
+ virtual void handle( const char *rq, const std::string& url, BSONObj params,
string& responseMsg, int& responseCode,
vector<string>& headers, const SockAddr &from ) {
@@ -110,7 +110,11 @@ namespace mongo {
responseMsg = ss.str();
}
- bool handleRESTQuery( string ns , string action , BSONObj & params , int & responseCode , stringstream & out ) {
+ bool handleRESTQuery( const std::string& ns,
+ const std::string& action,
+ BSONObj & params,
+ int & responseCode,
+ stringstream & out ) {
Timer t;
int html = _getOption( params["html"] , 0 );
@@ -208,7 +212,11 @@ namespace mongo {
}
// TODO Generate id and revision per couch POST spec
- void handlePost( string ns, const char *body, BSONObj& params, int & responseCode, stringstream & out ) {
+ void handlePost( const std::string& ns,
+ const char *body,
+ BSONObj& params,
+ int & responseCode,
+ stringstream & out ) {
try {
BSONObj obj = fromjson( body );
db.insert( ns.c_str(), obj );