]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/alist.h
!!! I didn't run the regression tests.!!!
[bacula/bacula] / bacula / src / lib / alist.h
index cf8fbf5bc552bcfbf1cbcebd9fc84ed7dcb1ed18..2fb63827d8bef4a293c2598f7de8ae1c19bc1d7d 100644 (file)
@@ -50,7 +50,7 @@ enum {
  * Array list -- much like a simplified STL vector
  *   array of pointers to inserted items
  */
-class alist {
+class alist : public SMARTALLOC {
    void **items;
    int num_items;
    int max_items;
@@ -65,17 +65,15 @@ public:
    void prepend(void *item);
    void *remove(int index);
    void *get(int index);
-   bool empty();
+   bool empty() const;
    void *prev();
    void *next();
    void *first();
    void *last();
    void * operator [](int index) const;
-   int size();
+   int size() const;
    void destroy();
    void grow(int num);
-   void * operator new(size_t);
-   void operator delete(void *);
 };
 
 inline void * alist::operator [](int index) const {
@@ -85,7 +83,7 @@ inline void * alist::operator [](int index) const {
    return items[index];
 }
 
-inline bool alist::empty()
+inline bool alist::empty() const
 {
    return num_items == 0;
 }
@@ -111,7 +109,7 @@ inline alist::alist(int num, bool own) {
 
 
 /* Current size of list */
-inline int alist::size()
+inline int alist::size() const 
 {
    return num_items;
 }
@@ -122,13 +120,4 @@ inline void alist::grow(int num)
    num_grow = num;
 }
 
-inline void * alist::operator new(size_t)
-{
-   return malloc(sizeof(alist));
-}
 
-inline void alist::operator delete(void  *item)
-{
-   ((alist *)item)->destroy();
-   free(item);
-}