/* list.c - Functions for manipulating linked lists of objects. */
-/* Copyright (C) 1996
- Free Software Foundation, Inc.
+/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
- Bash is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2, or (at your option) any later
- version.
+ Bash is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- Bash is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
+ Bash is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with Bash; see the file COPYING. If not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU General Public License
+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
+*/
#include "config.h"
#ifdef INCLUDE_UNUSED
/* Call FUNCTION on every member of LIST, a generic list. */
void
-map_over_list (list, function)
+list_walk (list, function)
GENERIC_LIST *list;
- Function *function;
+ sh_glist_func_t *function;
{
for ( ; list; list = list->next)
- (*function) (list);
+ if ((*function) (list) < 0)
+ return;
}
/* Call FUNCTION on every string in WORDS. */
void
-map_over_words (words, function)
+wlist_walk (words, function)
WORD_LIST *words;
- Function *function;
+ sh_icpfunc_t *function;
{
for ( ; words; words = words->next)
- (*function) (words->word->word);
+ if ((*function) (words->word->word) < 0)
+ return;
}
#endif /* INCLUDE_UNUSED */
of the chain. You should always assign the output value of this
function to something, or you will lose the chain. */
GENERIC_LIST *
-reverse_list (list)
+list_reverse (list)
GENERIC_LIST *list;
{
register GENERIC_LIST *next, *prev;
then ARG. Note that LIST contains the address of a variable which points
to the list. You might call this function like this:
- SHELL_VAR *elt = delete_element (&variable_list, check_var_has_name, "foo");
+ SHELL_VAR *elt = list_remove (&variable_list, check_var_has_name, "foo");
dispose_variable (elt);
*/
GENERIC_LIST *
-delete_element (list, comparer, arg)
+list_remove (list, comparer, arg)
GENERIC_LIST **list;
Function *comparer;
char *arg;