2 ** Copyright (C) 2002 by Kevin L. Mitchell <klmitch@mit.edu>
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Library General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2 of the License, or (at your option) any later version.
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Library General Public License for more details.
14 ** You should have received a copy of the GNU Library General Public
15 ** License along with this library; if not, write to the Free
16 ** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 #include "dbprim_int.h"
26 /** \ingroup dbprim_link
27 * \brief Iterate over each entry in a linked list.
29 * This function iterates over a linked list, executing the given \p
30 * iter_func for each entry.
32 * \param list A pointer to a #link_head_t.
34 * A pointer to a callback function used to perform
35 * user-specified actions on an element in a linked
36 * list. \c NULL is an invalid value. See the
37 * documentation for #link_iter_t for more information.
38 * \param extra A \c void pointer that will be passed to \p
41 * \retval DB_ERR_BADARGS An argument was invalid.
44 ll_iter(link_head_t *list, link_iter_t iter_func, void *extra)
49 initialize_dbpr_error_table(); /* initialize error table */
51 if (!ll_verify(list) || !iter_func) /* verify arguments */
52 return DB_ERR_BADARGS;
54 /* Walk through list and return first non-zero return value */
55 for (elem = list->lh_first; elem; elem = elem->le_next)
56 if ((retval = (*iter_func)(list, elem, extra)))