| 1 |
/*
|
| 2 |
strlist.h
|
| 3 |
String list macros for making char ** arrays
|
| 4 |
Copyright 2007 Gentoo Foundation
|
| 5 |
Based on a previous implementation by Martin Schlemmer
|
| 6 |
Released under the GPLv2
|
| 7 |
*/
|
| 8 |
|
| 9 |
#ifndef __STRLIST_H__
|
| 10 |
#define __STRLIST_H__
|
| 11 |
|
| 12 |
/* FIXME: We should replace the macro with an rc_strlist_foreach
|
| 13 |
function, but I'm unsure how to go about this. */
|
| 14 |
|
| 15 |
/* Step through each entry in the string list, setting '_pos' to the
|
| 16 |
beginning of the entry. '_counter' is used by the macro as index,
|
| 17 |
but should not be used by code as index (or if really needed, then
|
| 18 |
it should usually by +1 from what you expect, and should only be
|
| 19 |
used in the scope of the macro) */
|
| 20 |
#define STRLIST_FOREACH(_list, _pos, _counter) \
|
| 21 |
if ((_list) && _list[0] && ! (_counter = 0)) \
|
| 22 |
while ((_pos = _list[_counter++]))
|
| 23 |
|
| 24 |
#endif /* __STRLIST_H__ */
|