From: Thomas Jarosch Date: Mon, 17 Oct 2011 09:18:03 +0000 (+0200) Subject: Constification and minimal performance improvements X-Git-Tag: v2.6~31 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=83d700e93db5df7e9c276c315a75d6f9c7813dae;p=libi2ncommon Constification and minimal performance improvements --- diff --git a/src/cron.hpp b/src/cron.hpp index 9e392fe..0610eda 100644 --- a/src/cron.hpp +++ b/src/cron.hpp @@ -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; } diff --git a/src/ipfunc.cpp b/src/ipfunc.cpp index 95866f4..c54cbde 100644 --- a/src/ipfunc.cpp +++ b/src/ipfunc.cpp @@ -374,7 +374,7 @@ vector IP_RANGE::substract(const std::set &to_substract) con unsigned int ip_pos = turn_ip(ip), ip_end = turn_ip(end); set::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()); diff --git a/src/stringfunc.cpp b/src/stringfunc.cpp index b3fb22f..8f0464a 100644 --- a/src/stringfunc.cpp +++ b/src/stringfunc.cpp @@ -753,7 +753,7 @@ std::string strip_html_tags(const std::string &input) string output; vector >::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 >::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 += "'\\'"; diff --git a/src/week.hpp b/src/week.hpp index f5363bd..48d47cd 100644 --- a/src/week.hpp +++ b/src/week.hpp @@ -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; }