Commit 9e1c564f 9e1c564f2c769245d11439dfccd0af05b685e171 by Sergey Poznyakoff

Replace iterator_create with list_get_iterator.

1 parent 7ecfd2ab
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -41,9 +41,9 @@ print (list_t list)
iterator_t itr;
int rc;
rc = iterator_create (&itr, list);
rc = list_get_iterator (list, &itr);
if (rc)
lperror ("iterator_create", rc);
lperror ("list_get_iterator", rc);
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
{
......@@ -222,9 +222,9 @@ shell (list_t list)
for (num = 0; num < NITR; num++)
{
rc = iterator_create (&itr[num], list);
rc = list_get_iterator (list, &itr[num]);
if (rc)
lperror ("iterator_create", rc);
lperror ("list_get_iterator", rc);
iterator_first (itr[num]);
}
......
......@@ -2,6 +2,8 @@
GNU Mailutils nntp functions. This application interactively allows users
to contact a nntp server.
Copyright (C) 2003, 2004 Free Software Foundation
GNU Mailutils 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)
......@@ -497,7 +499,7 @@ com_list_extensions (char *arg ARG_UNUSED)
if (status == 0)
{
iterator_t iterator = NULL;
iterator_create (&iterator, list);
list_get_iterator (list, &iterator);
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
{
......
......@@ -2,6 +2,8 @@
GNU Mailutils pop3 functions. This application interactively allows users
to contact a pop3 server.
Copyright (C) 2003, 2004 Free Software Foundation
GNU Mailutils 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)
......@@ -404,7 +406,7 @@ com_capa (char *arg ARG_UNUSED)
if (status == 0)
{
iterator_t iterator = NULL;
iterator_create (&iterator, list);
list_get_iterator (list, &iterator);
for (iterator_first (iterator);
!iterator_is_done (iterator); iterator_next (iterator))
{
......@@ -429,7 +431,7 @@ com_uidl (char *arg)
if (status == 0)
{
iterator_t uidl_iterator = NULL;
iterator_create (&uidl_iterator, list);
list_get_iterator (list, &uidl_iterator);
for (iterator_first (uidl_iterator);
!iterator_is_done (uidl_iterator);
iterator_next (uidl_iterator))
......@@ -465,7 +467,7 @@ com_list (char *arg)
if (status == 0)
{
iterator_t list_iterator;
iterator_create (&list_iterator, list);
list_get_iterator (list, &list_iterator);
for (iterator_first (list_iterator);
!iterator_is_done (list_iterator);
iterator_next (list_iterator))
......
......@@ -1237,7 +1237,7 @@ util_run_events (int old_state, int new_state)
ev.old_state = old_state;
ev.new_state = new_state;
iterator_create (&itr, event_list);
list_get_iterator (event_list, &itr);
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
{
struct state_event *p;
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -69,7 +69,7 @@ _lookup (list_t list, const char *name)
iterator_t itr;
sieve_comparator_record_t *reg;
if (!list || iterator_create (&itr, list))
if (!list || list_get_iterator (list, &itr))
return NULL;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
......@@ -215,7 +215,7 @@ sieve_match_part_checker (const char *name, list_t tags, list_t args)
int matchtype;
int err = 0;
if (!tags || iterator_create (&itr, tags))
if (!tags || list_get_iterator (tags, &itr))
return 0;
for (iterator_first (itr); !err && !iterator_is_done (itr);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -149,7 +149,7 @@ sieve_code_command (sieve_register_t *reg, list_t arglist)
if (arglist)
{
rc = iterator_create (&itr, arglist);
rc = list_get_iterator (arglist, &itr);
if (rc)
{
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -31,7 +31,7 @@ reg_lookup (list_t list, const char *name)
iterator_t itr;
sieve_register_t *reg;
if (!list || iterator_create (&itr, list))
if (!list || list_get_iterator (list, &itr))
return NULL;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -31,7 +31,7 @@ sieve_require (list_t slist)
int status;
iterator_t itr;
status = iterator_create (&itr, slist);
status = list_get_iterator (slist, &itr);
if (status)
{
sieve_compile_error (sieve_filename, sieve_line_num,
......
%{
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -677,7 +677,7 @@ line_finish ()
int length = 0;
char *p;
if (!string_list || iterator_create (&itr, string_list))
if (!string_list || list_get_iterator (string_list, &itr))
return;
/* Count number of characters in the multiline */
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -144,7 +144,7 @@ get_sender_address (message_t msg)
if (message_get_header (msg, &header))
return NULL;
if (!sender_headers || iterator_create (&itr, sender_headers))
if (!sender_headers || list_get_iterator (sender_headers, &itr))
return NULL;
for (iterator_first (itr); !addr && !iterator_is_done (itr);
......
......@@ -698,7 +698,7 @@ util_slist_print (list_t list, int nl)
iterator_t itr;
char *name;
if (!list || iterator_create (&itr, list))
if (!list || list_get_iterator (list, &itr))
return;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
......@@ -717,7 +717,7 @@ util_slist_lookup (list_t list, char *str)
char *name;
int rc = 0;
if (!list || iterator_create (&itr, list))
if (!list || list_get_iterator (list, &itr))
return 0;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
......@@ -773,7 +773,7 @@ util_slist_destroy (list_t *list)
iterator_t itr;
char *name;
if (!*list || iterator_create (&itr, *list))
if (!*list || list_get_iterator (*list, &itr))
return;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
......@@ -792,7 +792,7 @@ util_slist_to_string (list_t list, const char *delim)
char *name;
char *str = NULL;
if (!list || iterator_create (&itr, list))
if (!list || list_get_iterator (list, &itr))
return NULL;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
......
......@@ -173,7 +173,7 @@ filter_create (stream_t *pstream, stream_t stream, const char *name,
return EINVAL;
filter_get_list (&list);
status = iterator_create (&iterator, list);
status = list_get_iterator (list, &iterator);
if (status != 0)
return status;
......
......@@ -67,7 +67,7 @@ folder_create (folder_t *pfolder, const char *name)
/* Look in the registrar list(iterator), for a possible concrete mailbox
implementatio that could match the URL. */
registrar_get_list (&list);
status = iterator_create (&iterator, list);
status = list_get_iterator (list, &iterator);
if (status != 0)
return status;
for (iterator_first (iterator); !iterator_is_done (iterator);
......@@ -418,7 +418,7 @@ is_known_folder (url_t url, folder_t *pfolder)
if (url == NULL || pfolder == NULL)
return ret;
if (iterator_create (&iterator, known_folder_list) != 0)
if (list_get_iterator (known_folder_list, &iterator) != 0)
return ret;
for (iterator_first (iterator); !iterator_is_done (iterator);
......
......@@ -58,7 +58,7 @@ mailbox_create (mailbox_t *pmbox, const char *name)
/* Look in the registrar, for a match */
registrar_get_list (&list);
status = iterator_create (&iterator, list);
status = list_get_iterator (list, &iterator);
if (status != 0)
return status;
for (iterator_first (iterator); !iterator_is_done (iterator);
......
......@@ -98,7 +98,7 @@ mailer_create (mailer_t * pmailer, const char *name)
mailer_get_url_default (&name);
registrar_get_list (&list);
status = iterator_create (&iterator, list);
status = list_get_iterator (list, &iterator);
if (status != 0)
return status;
for (iterator_first (iterator); !iterator_is_done (iterator);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -129,7 +129,7 @@ mu_auth_runlist (list_t flist, struct mu_auth_data **return_data,
int rc = 1;
iterator_t itr;
if (iterator_create (&itr, flist) == 0)
if (list_get_iterator (flist, &itr) == 0)
{
struct auth_stack_entry *ep;
......@@ -330,7 +330,7 @@ _locate (const char *name)
struct _module_handler *rp = NULL;
iterator_t itr;
if (iterator_create (&itr, module_handler_list) == 0)
if (list_get_iterator (module_handler_list, &itr) == 0)
{
struct _module_handler *p;
......@@ -431,7 +431,7 @@ mu_auth_begin_setup ()
if (!mu_authenticate_list)
{
if (iterator_create (&itr, module_handler_list) == 0)
if (list_get_iterator (module_handler_list, &itr) == 0)
{
struct _module_handler *mod;
......@@ -448,7 +448,7 @@ mu_auth_begin_setup ()
if (!mu_auth_by_name_list)
{
if (iterator_create (&itr, module_handler_list) == 0)
if (list_get_iterator (module_handler_list, &itr) == 0)
{
struct _module_handler *mod;
......
......@@ -265,7 +265,7 @@ mu_retrieve (list_t flist, void *data)
void *p = NULL;
iterator_t itr;
if (iterator_create (&itr, flist) == 0)
if (list_get_iterator (flist, &itr) == 0)
{
mu_retrieve_fp fun;
for (iterator_first (itr); !p && !iterator_is_done (itr);
......
......@@ -134,7 +134,7 @@ observable_destroy (observable_t *pobservable, void *owner)
observable_t observable = *pobservable;
if (observable->owner == owner)
{
int status = iterator_create (&iterator, observable->list);
int status = list_get_iterator (observable->list, &iterator);
if (status == 0)
{
event_t event = NULL;
......@@ -185,9 +185,9 @@ observable_detach (observable_t observable, observer_t observer)
int status;
int found = 0;
event_t event = NULL;
if (observable == NULL ||observer == NULL)
if (observable == NULL || observer == NULL)
return EINVAL;
status = iterator_create (&iterator, observable->list);
status = list_get_iterator (observable->list, &iterator);
if (status != 0)
return status;
for (iterator_first (iterator); !iterator_is_done (iterator);
......@@ -220,7 +220,7 @@ observable_notify (observable_t observable, int type)
int status = 0;
if (observable == NULL)
return EINVAL;
status = iterator_create (&iterator, observable->list);
status = list_get_iterator (observable->list, &iterator);
if (status != 0)
return status;
for (iterator_first (iterator); !iterator_is_done (iterator);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -121,7 +121,7 @@ ali_print_name_list (list_t list, int off)
iterator_t itr;
char *item;
iterator_create (&itr, list);
list_get_iterator (list, &itr);
if (list_mode)
{
......
%{
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -61,7 +61,7 @@ ali_list_to_string (list_t *plist)
char *p;
size_t length = 0;
iterator_t itr;
iterator_create (&itr, *plist);
list_get_iterator (*plist, &itr);
for (iterator_first (itr); !iterator_is_done (itr); iterator_next(itr))
{
char *s;
......@@ -207,7 +207,7 @@ ali_list_dup (list_t src)
if (list_create (&dst))
return NULL;
if (iterator_create (&itr, src))
if (list_get_iterator (src, &itr))
{
list_destroy (&dst);
return NULL;
......@@ -229,7 +229,7 @@ ali_member (list_t list, char *name)
iterator_t itr;
int found = 0;
if (iterator_create (&itr, list))
if (list_get_iterator (list, &itr))
return 0;
for (iterator_first (itr); !found && !iterator_is_done (itr);
iterator_next (itr))
......@@ -266,7 +266,7 @@ _insert_list (list_t list, void *prev, list_t new_list)
{
iterator_t itr;
if (iterator_create (&itr, new_list))
if (list_get_iterator (new_list, &itr))
return 1;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
{
......@@ -288,7 +288,7 @@ alias_expand_list (list_t name_list, iterator_t orig_itr, int *inclusive)
{
iterator_t itr;
if (iterator_create (&itr, name_list))
if (list_get_iterator (name_list, &itr))
return 1;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
{
......@@ -318,7 +318,7 @@ mh_alias_get_internal (char *name, iterator_t start, list_t *return_list,
if (!start)
{
if (iterator_create (&itr, alias_list))
if (list_get_iterator (alias_list, &itr))
return 1;
iterator_first (itr);
}
......@@ -368,7 +368,7 @@ mh_alias_get_address (char *name, address_t *paddr, int *incl)
return 1;
}
if (iterator_create (&itr, list) == 0)
if (list_get_iterator (list, &itr) == 0)
{
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
{
......@@ -416,7 +416,7 @@ mh_alias_get_alias (char *uname, list_t *return_list)
iterator_t itr;
int rc = 1;
if (iterator_create (&itr, alias_list))
if (list_get_iterator (alias_list, &itr))
return 1;
for (iterator_first (itr); !iterator_is_done (itr); iterator_next (itr))
{
......@@ -441,7 +441,7 @@ mh_alias_enumerate (mh_alias_enumerator_t fun, void *data)
iterator_t itr;
int rc = 0;
if (iterator_create (&itr, alias_list))
if (list_get_iterator (alias_list, &itr))
return ;
for (iterator_first (itr);
rc == 0 && !iterator_is_done (itr);
......
%{
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -261,7 +261,7 @@ pick_parse (list_t toklist)
return 0;
}
if (iterator_create (&iterator, toklist))
if (list_get_iterator (toklist, &iterator))
return -1;
iterator_first (iterator);
rc = yyparse ();
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2002,2003 Free Software Foundation, Inc.
Copyright (C) 2002,2003,2004 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -96,7 +96,7 @@ open_folders ()
exit (1);
}
if (iterator_create (&itr, folder_name_list))
if (list_get_iterator (folder_name_list, &itr))
{
mh_error (_("can't create iterator"));
exit (1);
......@@ -121,7 +121,7 @@ enumerate_folders (void (*f) __P((void *, mailbox_t)), void *data)
{
iterator_t itr;
if (iterator_create (&itr, folder_mbox_list))
if (list_get_iterator (folder_mbox_list, &itr))
{
mh_error (_("can't create iterator"));
exit (1);
......