Browse Source

Optimize CivetServer::getPostData

Use std::string::append instead of creating std::string object for each append.
Rimas Misevičius 5 năm trước cách đây
mục cha
commit
b564474d40
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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);