/[baselayout]/trunk/src/strlist.h
Gentoo

Contents of /trunk/src/strlist.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2550 - (show annotations) (download) (as text)
Fri Apr 6 01:04:07 2007 UTC (7 years, 5 months ago) by uberlord
File MIME type: text/x-chdr
File size: 836 byte(s)
Misc fixes, plugged a memory leak in runscript.c and use va_copy to avoid nasty segfaults
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__ */

  ViewVC Help
Powered by ViewVC 1.1.20