all repos — fluxbox @ 6dc5ca4e60b80a1d900f87a4e70954cd29cfcee4

custom fork of the fluxbox windowmanager

some minor code cleanups thanks Slava Semushin (php-coder), who also thanks Mikhail Gusarov
simonb simonb
commit

6dc5ca4e60b80a1d900f87a4e70954cd29cfcee4

parent

b79d7ee745256eb14d664dcc1a6dac8520c9f490

4 files changed, 13 insertions(+), 28 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 1.0rc2: *06/06/27: + * Some minor cleaning (thanks Slava Semushin + Mikhail Gusarov) + FbTk/StringUtil.hh/cc Remember.cc * Fix slit menu so it closes when you press escape (Mark) Slit.cc *06/06/26:
M src/FbTk/StringUtil.ccsrc/FbTk/StringUtil.cc

@@ -58,18 +58,6 @@

namespace StringUtil { /** - Takes a pointer to string *s as an argument, - creates a new string n, copies s to n and - returns a pointer to n. -*/ -char *strdup(const char *s) { - int l = strlen(s) + 1; - char *n = new char[l]; - strncpy(n, s, l); - return n; -} - -/** Tries to find a string in another and ignoring the case of the characters Returns 0 on success else pointer to str.
M src/FbTk/StringUtil.hhsrc/FbTk/StringUtil.hh

@@ -30,7 +30,6 @@ namespace FbTk {

namespace StringUtil { -char *strdup(const char *); /// Similar to `strstr' but this function ignores the case of both strings const char *strcasestr(const char *str, const char *ptn);
M src/Remember.ccsrc/Remember.cc

@@ -61,7 +61,7 @@

namespace { bool getuint(const char *val, unsigned int &ret) { - return (sscanf(val, "%ui", &ret) == 1); + return (sscanf(val, "%u", &ret) == 1); } class RememberMenuItem : public FbTk::MenuItem {

@@ -263,9 +263,8 @@ m_pats->erase(it);

} std::set<Application *>::iterator ait = all_apps.begin(); // no duplicates - while (ait != all_apps.end()) { + for (; ait != all_apps.end(); ++ait) { delete (*ait); - ++ait; } s_instance = 0;

@@ -380,7 +379,7 @@ if (!had_error)

app.rememberLayer(l); } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) { unsigned int h,w; - if (sscanf(str_label.c_str(), "%i %i", &w, &h) == 2) + if (sscanf(str_label.c_str(), "%u %u", &w, &h) == 2) app.rememberDimensions(w, h); else had_error = true;

@@ -404,7 +403,7 @@ had_error = 1;

} } - if (!had_error && sscanf(str_label.c_str(), "%i %i", &x, &y) == 2) + if (!had_error && sscanf(str_label.c_str(), "%u %u", &x, &y) == 2) app.rememberPosition(x, y, r); else had_error = true;

@@ -501,12 +500,11 @@ break;

} // forward - while (it != it_end && it->second == ret) { - tmpit = it; - ++it; - delete tmpit->first; - patlist->erase(tmpit); + for(; it != it_end && it->second == ret; ++it) { + delete it->first; } + patlist->erase(patlist->begin(), it); + return ret; } }

@@ -643,9 +641,8 @@ }

} std::set<Application *>::iterator ait = old_apps.begin(); // no duplicates - while (ait != old_apps.end()) { + for (; ait != old_apps.end(); ++ait) { delete (*ait); - ++ait; } delete old_pats;

@@ -1062,7 +1059,7 @@ Application *app = find(winclient);

if (app && (app->save_on_close_remember && app->save_on_close)) { - for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) { + for (int attrib = 0; attrib < REM_LASTATTRIB; attrib++) { if (isRemembered(winclient, (Attribute) attrib)) { rememberAttrib(winclient, (Attribute) attrib); }

@@ -1091,9 +1088,8 @@

void Remember::updateFrameClose(FluxboxWindow &win) { // scan all applications and remove this fbw if it is a recorded group Patterns::iterator it = m_pats->begin(); - while (it != m_pats->end()) { + for (; it != m_pats->end(); ++it) { if (&win == it->second->group) it->second->group = 0; - ++it; } }