X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Flib%2Falist.h;h=d2f1d06fac38c5064d179fc11e02590dc2977efb;hb=dac031f738d2bf3248be90c6d798f104e2ecd9dc;hp=85698e9f3f6d48d82b37f16699e5ff187bfd24ee;hpb=cb739c1363e880da63e884570fd76fc399e9bbb8;p=bacula%2Fbacula diff --git a/bacula/src/lib/alist.h b/bacula/src/lib/alist.h index 85698e9f3f..d2f1d06fac 100644 --- a/bacula/src/lib/alist.h +++ b/bacula/src/lib/alist.h @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2003-2011 Free Software Foundation Europe e.V. + Copyright (C) 2003-2012 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -47,6 +47,15 @@ (*((void **)&(var))=(void*)((list)->next()))) #endif +#ifdef HAVE_TYPEOF +#define foreach_alist_index(inx, var, list) \ + for(inx=0; ((var)=(typeof(var))(list)->get(inx)); inx++ ) +#else +#define foreach_alist_index(inx, var, list) \ + for(inx=0; ((*((void **)&(var))=(void*)((list)->get(inx)))); inx++ ) +#endif + + /* Second arg of init */ @@ -81,6 +90,7 @@ public: void *first(); void *last(); void * operator [](int index) const; + int current() const { return cur_item; }; int size() const; void destroy(); void grow(int num);