00001 /* 00002 strlist.h 00003 String list macros for making char ** arrays 00004 Copyright 2007 Gentoo Foundation 00005 Based on a previous implementation by Martin Schlemmer 00006 Released under the GPLv2 00007 */ 00008 00009 #ifndef __STRLIST_H__ 00010 #define __STRLIST_H__ 00011 00012 /* FIXME: We should replace the macro with an rc_strlist_foreach 00013 function, but I'm unsure how to go about this. */ 00014 00015 /* Step through each entry in the string list, setting '_pos' to the 00016 beginning of the entry. '_counter' is used by the macro as index, 00017 but should not be used by code as index (or if really needed, then 00018 it should usually by +1 from what you expect, and should only be 00019 used in the scope of the macro) */ 00020 #define STRLIST_FOREACH(_list, _pos, _counter) \ 00021 if ((_list) && _list[0] && ! (_counter = 0)) \ 00022 while ((_pos = _list[_counter++])) 00023 00024 #endif /* __STRLIST_H__ */