Commit da1b73a6 da1b73a639f86ecd9f07aff287499bec4d4c9b58 by Sergey Poznyakoff

(mu_iterator_current_kv): New function

(mu_iterator_set_getitem): Change signature. All references updated.
1 parent 79d323ff
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2004, 2005, 2007 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
......@@ -30,7 +30,9 @@ extern int mu_iterator_dup (mu_iterator_t *piterator, mu_iterator_t orig);
extern void mu_iterator_destroy (mu_iterator_t *);
extern int mu_iterator_first (mu_iterator_t);
extern int mu_iterator_next (mu_iterator_t);
extern int mu_iterator_current (mu_iterator_t, void * const *pitem);
extern int mu_iterator_current (mu_iterator_t, void **pitem);
extern int mu_iterator_current_kv (mu_iterator_t,
const void **key, void **pitem);
extern int mu_iterator_is_done (mu_iterator_t);
extern int mu_iterator_attach (mu_iterator_t *root, mu_iterator_t iterator);
......@@ -40,7 +42,8 @@ extern void mu_iterator_advance (mu_iterator_t iterator, void *e);
extern int mu_iterator_set_first (mu_iterator_t, int (*first) (void *));
extern int mu_iterator_set_next (mu_iterator_t, int (*next) (void *));
extern int mu_iterator_set_getitem (mu_iterator_t,
int (*getitem) (void *, void **));
int (*getitem) (void *, void **,
const void **pkey));
extern int mu_iterator_set_finished_p (mu_iterator_t,
int (*finished_p) (void *));
extern int mu_iterator_set_dup (mu_iterator_t itr,
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
......@@ -32,7 +32,7 @@ static int nntp_itr_dup (void **ptr, void *owner);
static int nntp_itr_destroy (mu_iterator_t itr, void *owner);
static int nntp_itr_first (void *owner);
static int nntp_itr_next (void *woner);
static int nntp_itr_getitem (void *owner, void **pret);
static int nntp_itr_getitem (void *owner, void **pret, const void **pkey);
static int nntp_itr_curitem_p (void *owner, void *data);
static int nntp_itr_finished_p (void *owner);
......@@ -158,7 +158,7 @@ nntp_itr_next (void *owner)
}
static int
nntp_itr_getitem (void *owner, void **item)
nntp_itr_getitem (void *owner, void **item, const void **pkey)
{
struct nntp_iterator *nntp_iterator = (struct nntp_iterator *)owner;
if (item)
......@@ -166,6 +166,8 @@ nntp_itr_getitem (void *owner, void **item)
*((char **)item) = nntp_iterator->item;
nntp_iterator->item = NULL;
}
if (pkey)
*pkey = NULL;
return 0;
}
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
......@@ -31,7 +31,7 @@ static int pop3_itr_dup (void **ptr, void *owner);
static int pop3_itr_destroy (mu_iterator_t itr, void *owner);
static int pop3_itr_first (void *owner);
static int pop3_itr_next (void *woner);
static int pop3_itr_getitem (void *owner, void **pret);
static int pop3_itr_getitem (void *owner, void **pret, const void **pkey);
static int pop3_itr_curitem_p (void *owner, void *data);
static int pop3_itr_finished_p (void *owner);
......@@ -157,7 +157,7 @@ pop3_itr_next (void *owner)
}
static int
pop3_itr_getitem (void *owner, void **item)
pop3_itr_getitem (void *owner, void **item, const void **pkey)
{
struct pop3_iterator *pop3_iterator = (struct pop3_iterator *)owner;
if (item)
......@@ -165,6 +165,8 @@ pop3_itr_getitem (void *owner, void **item)
*((char **)item) = pop3_iterator->item;
pop3_iterator->item = NULL;
}
if (pkey)
*pkey = NULL;
return 0;
}
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2004, 2005, 2007 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
......@@ -62,7 +62,8 @@ mu_iterator_set_next (mu_iterator_t itr, int (*next) (void *))
}
int
mu_iterator_set_getitem (mu_iterator_t itr, int (*getitem) (void *, void **))
mu_iterator_set_getitem (mu_iterator_t itr,
int (*getitem) (void *, void **, const void **))
{
if (!itr)
return EINVAL;
......@@ -174,9 +175,16 @@ mu_iterator_next (mu_iterator_t iterator)
}
int
mu_iterator_current (mu_iterator_t iterator, void * const *pitem)
mu_iterator_current (mu_iterator_t iterator, void **pitem)
{
return iterator->getitem (iterator->owner, (void**)pitem);
return iterator->getitem (iterator->owner, pitem, NULL);
}
int
mu_iterator_current_kv (mu_iterator_t iterator,
const void **pkey, void **pitem)
{
return iterator->getitem (iterator->owner, (void**)pitem, pkey);
}
int
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007 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
......@@ -410,10 +410,12 @@ next (void *owner)
}
static int
getitem (void *owner, void **pret)
getitem (void *owner, void **pret, const void **pkey)
{
struct list_iterator *itr = owner;
*pret = itr->cur->item;
if (pkey)
*pkey = NULL;
return 0;
}
......