summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/tools.c b/tools.c
index 075be185..9e1ea1d0 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.92 2005/05/16 09:55:26 kls Exp $
+ * $Id: tools.c 1.93 2005/05/26 11:40:14 kls Exp $
*/
#include "tools.h"
@@ -932,6 +932,7 @@ int cListObject::Index(void) const
cListBase::cListBase(void)
{
objects = lastObject = NULL;
+ count = 0;
}
cListBase::~cListBase()
@@ -952,6 +953,7 @@ void cListBase::Add(cListObject *Object, cListObject *After)
objects = Object;
lastObject = Object;
}
+ count++;
}
void cListBase::Ins(cListObject *Object, cListObject *Before)
@@ -967,6 +969,7 @@ void cListBase::Ins(cListObject *Object, cListObject *Before)
lastObject = Object;
objects = Object;
}
+ count++;
}
void cListBase::Del(cListObject *Object, bool DeleteObject)
@@ -978,6 +981,7 @@ void cListBase::Del(cListObject *Object, bool DeleteObject)
Object->Unlink();
if (DeleteObject)
delete Object;
+ count--;
}
void cListBase::Move(int From, int To)
@@ -1017,6 +1021,7 @@ void cListBase::Clear(void)
objects = object;
}
objects = lastObject = NULL;
+ count = 0;
}
cListObject *cListBase::Get(int Index) const
@@ -1029,18 +1034,6 @@ cListObject *cListBase::Get(int Index) const
return object;
}
-int cListBase::Count(void) const
-{
- int n = 0;
- cListObject *object = objects;
-
- while (object) {
- n++;
- object = object->Next();
- }
- return n;
-}
-
static int CompareListObjects(const void *a, const void *b)
{
const cListObject *la = *(const cListObject **)a;
@@ -1062,6 +1055,7 @@ void cListBase::Sort(void)
objects = lastObject = NULL;
for (i = 0; i < n; i++) {
a[i]->Unlink();
+ count--;
Add(a[i]);
}
}