]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/alist.h
- Correct compiler complaints in wx-console and tray-monitor.
[bacula/bacula] / bacula / src / lib / alist.h
index 2a1a26d18241d6695ea64265abd9202f7270f253..30eefed03153f68aa7b61760c7b784a2727d1022 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 /*
-   Copyright (C) 2003-2004 Kern Sibbald and John Walker
+   Copyright (C) 2003-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
  * Loop var through each member of list
  */
 #define foreach_alist(var, list) \
-    for((*((void **)&(var))=(void*)((list)->first())); (var); (*((void **)&(var))=(void*)((list)->next())))
+    for((*((void **)&(var))=(void*)((list)->first())); \
+         (var); \
+         (*((void **)&(var))=(void*)((list)->next())))
 
 #ifdef the_easy_way
 #define foreach_alist(var, list) \
-       for((void*(var))=(list)->first(); (var); (void *(var))=(list)->next(var)); )
+        for((void*(var))=(list)->first(); (var); (void *(var))=(list)->next(var)); )
 #endif
 
 
@@ -75,6 +77,10 @@ public:
    int size() const;
    void destroy();
    void grow(int num);
+
+   /* Use it as a stack, pushing and poping from the end */
+   void push(void *item) { append(item); };
+   void pop() { num_items?NULL:remove(num_items-1); };
 };
 
 inline void * alist::operator [](int index) const {