Explorar el Código

Optimize CivetServer::getPostData

Use std::string::append instead of creating std::string object for each append.
Rimas Misevičius hace 5 años
padre
commit
b564474d40
Se han modificado 1 ficheros con 1 adiciones y 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);