From: Alan T. DeKok Date: Sat, 26 Mar 2022 13:05:06 +0000 (-0400) Subject: move private macros to private header X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dad16f91a7ee4af6842337d52a03b60b5dacf0c1;p=thirdparty%2Ffreeradius-server.git move private macros to private header --- diff --git a/src/lib/server/cf_priv.h b/src/lib/server/cf_priv.h index a6dcb7ed66..c6a8432a88 100644 --- a/src/lib/server/cf_priv.h +++ b/src/lib/server/cf_priv.h @@ -127,6 +127,25 @@ typedef struct { bool from_dir; //!< was read from a directory } cf_file_t; +/** Iterate over the contents of a list + * + * @param[in] _ci to iterate over. + * @param[in] _iter Name of iteration variable. + * Will be declared in the scope of the loop. + */ +#define cf_item_foreach(_ci, _iter) \ + for (CONF_ITEM *_iter = fr_dlist_head(&(_ci)->children); _iter; _iter = fr_dlist_next(&(_ci)->children, _iter)) + +/** Iterate over the contents of a list + * + * @param[in] _ci to iterate over. + * @param[in] _iter Name of iteration variable. + * Will be declared in the scope of the loop. + * @param[in] _prev previous pointer + */ +#define cf_item_foreach_prev(_ci, _iter, _prev) \ + for (CONF_ITEM *_iter = fr_dlist_next(&(_ci)->children, _prev); _iter; _iter = fr_dlist_next(&(_ci)->children, _iter)) + /** Check if the CONF_ITEM has no children. * * Which is the common use-case diff --git a/src/lib/server/cf_util.h b/src/lib/server/cf_util.h index c7620bb141..a8b4771d96 100644 --- a/src/lib/server/cf_util.h +++ b/src/lib/server/cf_util.h @@ -92,25 +92,6 @@ CONF_ITEM *_cf_item_remove(CONF_ITEM *parent, CONF_ITEM *child); #define cf_item_next(_ci, _prev) _cf_item_next(CF_TO_ITEM(_ci), _prev) CONF_ITEM *_cf_item_next(CONF_ITEM const *ci, CONF_ITEM const *prev); -/** Iterate over the contents of a list - * - * @param[in] _ci to iterate over. - * @param[in] _iter Name of iteration variable. - * Will be declared in the scope of the loop. - */ -#define cf_item_foreach(_ci, _iter) \ - for (CONF_ITEM *_iter = fr_dlist_head(&(_ci)->children); _iter; _iter = fr_dlist_next(&(_ci)->children, _iter)) - -/** Iterate over the contents of a list - * - * @param[in] _ci to iterate over. - * @param[in] _iter Name of iteration variable. - * Will be declared in the scope of the loop. - * @param[in] _prev previous pointer - */ -#define cf_item_foreach_prev(_ci, _iter, _prev) \ - for (CONF_ITEM *_iter = fr_dlist_next(&(_ci)->children, _prev); _iter; _iter = fr_dlist_next(&(_ci)->children, _iter)) - #define cf_root(_cf) _cf_root(CF_TO_ITEM(_cf)) CONF_SECTION *_cf_root(CONF_ITEM const *ci);