Author: wyoung
Date: Tue Feb 20 15:44:14 2007
New Revision: 1427
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1427&view=rev
Log:
Optimized Query::preview_char() a bit more. Patch by Jonathan Wakely
<[EMAIL PROTECTED]>
Modified:
trunk/lib/query.cpp
Modified: trunk/lib/query.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1427&r1=1426&r2=1427&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Tue Feb 20 15:44:14 2007
@@ -349,10 +349,9 @@
char*
Query::preview_char()
{
- size_t length = sbuffer_.str().size();
- char* s = new char[length + 1];
- memcpy(s, sbuffer_.str().c_str(), length);
- s[length] = '\0';
+ const std::string& str(sbuffer_.str());
+ char* s = new char[str.size() + 1];
+ memcpy(s, str.c_str(), str.size() + 1);
return s;
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits