I tested your patch, and it seems to work well. Thank you for improving that code.
Reviewed by: Karel Klic kklic@redhat.com
Dne 18.3.2010 14:12, Denys Vlasenko napsal(a):
On Wed, 2010-03-17 at 11:53 +0100, Karel Klic wrote:
On 03/16/2010 03:05 PM, Denys Vlasenko wrote:
+static vector_string_t split(const std::string&s, char delim) +{
- std::stringstream ss(s);
- std::string item;
- std::vectorstd::string elems;
- while (std::getline(ss, item, delim))
- elems.push_back(item);
- return elems;
+}
Use of C++ streams usually adds on the order of 10k of code. We need to talk later whether we want to go entirely C. For now, personally I try to minimize usage of C++ constructs. Here, looks like you can as easily perform splitting using, say, loop with strchr('\n') inside.
Agreed. I rewrote this routine to use strtok_r.
Eh, since I am late in commenting, I can't ask *you* to do it a bit differently, I guess I have to propose the my own patch on top.
Here is it.
Sometime ago we talked about const string parameters and decided to generally use const char*, not const string&. The patch below uses that convention. It also fixes a check for enabled plugins and does a fem other small tweaks.
Please review...