Procházet zdrojové kódy

Optimize CivetServer::getPostData

Use std::string::append instead of creating std::string object for each append.
Rimas Misevičius před 5 roky
rodič
revize
b564474d40
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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);