Constification and minimal performance improvements
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 17 Oct 2011 09:18:03 +0000 (11:18 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 17 Oct 2011 09:18:03 +0000 (11:18 +0200)
src/cron.hpp
src/ipfunc.cpp
src/stringfunc.cpp
src/week.hpp

index 9e392fe..0610eda 100644 (file)
@@ -65,19 +65,19 @@ class WeekCron
         WeekCron(const I2n::Time::Week& week, const int begin, const int end, const int every);
 
         // accessor functions
-        I2n::Time::Week get_week(void)
+        I2n::Time::Week get_week(void) const
             { return Week; }
         void set_week(const I2n::Time::Week& week)
             { Week=week; }
-        int get_begin(void)
+        int get_begin(void) const
             { return Begin; }
         void set_begin(const int begin)
             { Begin=begin; }
-        int get_end(void)
+        int get_end(void) const
             { return End; }
         void set_end(const int end)
             { End=end; }
-        int get_every(void)
+        int get_every(void) const
             { return Every; }
         void set_every(const int every)
             { Every=every; }
index 95866f4..c54cbde 100644 (file)
@@ -374,7 +374,7 @@ vector<IP_RANGE> IP_RANGE::substract(const std::set<IP_RANGE> &to_substract) con
     unsigned int ip_pos = turn_ip(ip), ip_end = turn_ip(end);
     
     set<IP_RANGE>::const_iterator sub = to_substract.begin(), to_substract_end = to_substract.end();
-    for (sub = to_substract.begin(); sub != to_substract_end; sub++) {
+    for (sub = to_substract.begin(); sub != to_substract_end; ++sub) {
         if (!sub->is_within(*this))
             throw runtime_error("IP_RANGE::substract error: "+ sub->to_string() + " is not within " + to_string());
     
index b3fb22f..8f0464a 100644 (file)
@@ -753,7 +753,7 @@ std::string strip_html_tags(const std::string &input)
 
    string output;
    vector<pair<string,bool> >::const_iterator token, tokens_end = tokenized.end();
-   for (token = tokenized.begin(); token != tokens_end; token++)
+   for (token = tokenized.begin(); token != tokens_end; ++token)
       if (!token->second)
          output += token->first;
 
@@ -770,7 +770,7 @@ string smart_html_entities(const std::string &input)
 
    string output;
    vector<pair<string,bool> >::const_iterator token, tokens_end = tokenized.end();
-   for (token = tokenized.begin(); token != tokens_end; token++)
+   for (token = tokenized.begin(); token != tokens_end; ++token)
    {
       // keep HTML tags as they are
       if (token->second)
@@ -1100,7 +1100,7 @@ string escape_shellarg(const string &input)
 {
    string output = "'";
    string::const_iterator it, it_end = input.end();
-   for (it = input.begin(); it != it_end; it++)
+   for (it = input.begin(); it != it_end; ++it)
    {
       if ( (*it) == '\'')
          output += "'\\'";
index f5363bd..48d47cd 100644 (file)
@@ -97,12 +97,12 @@ class Week
             return *this;
         }
 
-        bool operator==(const Week& rhs)
+        bool operator==(const Week& rhs) const
         {
             return Days == rhs.Days;
         }
 
-        bool operator!=(const Week& rhs)
+        bool operator!=(const Week& rhs) const
         {
             return Days != rhs.Days;
         }