Explorar o código

Optimize CivetServer::getPostData

Use std::string::append instead of creating std::string object for each append.
Rimas Misevičius %!s(int64=5) %!d(string=hai) anos
pai
achega
b564474d40
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/CivetServer.cpp

+ 1 - 1
src/CivetServer.cpp

@@ -584,7 +584,7 @@ CivetServer::getPostData(struct mg_connection *conn)
 	char buf[2048];
 	int r = mg_read(conn, buf, sizeof(buf));
 	while (r > 0) {
-		postdata += std::string(buf, r);
+		postdata.append(buf, r);
 		r = mg_read(conn, buf, sizeof(buf));
 	}
 	mg_unlock_connection(conn);