[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/strigi/src/streamanalyzer
From:       Jos van den Oever <jos () vandenoever ! info>
Date:       2009-05-03 11:34:45
Message-ID: 1241350485.108641.22715.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 962781 by vandenoever:

Reduce number of memory allocations by smart trimming.


 M  +2 -2      fieldpropertiesdb.cpp  


--- trunk/kdesupport/strigi/src/streamanalyzer/fieldpropertiesdb.cpp #962780:962781
@@ -475,8 +475,8 @@
          size_t namelen, const char* value, size_t valuelen) {
     bool boolValue;
     //Trim leading and trailing whitespace
-    string val(value, valuelen);
-    val.erase(0, val.find_first_not_of(" \t\n"));
+    size_t trimmedvallen = valuelen - strspn(value, " \t\n");
+    string val(value + valuelen - trimmedvallen, trimmedvallen);
     val.erase(val.find_last_not_of(" \t\n") + 1);
 
     if (currentDefinition == defProperty) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic