Browse Source

[trac846] Simplify the function

Michal 'vorner' Vaner 14 years ago
parent
commit
3427f48990
1 changed files with 2 additions and 6 deletions
  1. 2 6
      src/lib/config/tests/fake_session.cc

+ 2 - 6
src/lib/config/tests/fake_session.cc

@@ -53,17 +53,13 @@ listContains(ConstElementPtr list, ConstElementPtr el) {
 void
 void
 listRemove(ElementPtr list, ConstElementPtr el) {
 listRemove(ElementPtr list, ConstElementPtr el) {
     int i = 0;
     int i = 0;
-    int position = -1;
     BOOST_FOREACH(ConstElementPtr s_el, list->listValue()) {
     BOOST_FOREACH(ConstElementPtr s_el, list->listValue()) {
         if (*el == *s_el) {
         if (*el == *s_el) {
-            position = i;
-            break;
+            list->remove(i);
+            return;
         }
         }
         i++;
         i++;
     }
     }
-    if (position >= 0) {
-        list->remove(position);
-    }
 }
 }
 // endwant
 // endwant