1*2e8d1edaSArun Thomas /* $OpenBSD: ohash_enum.c,v 1.3 2004/06/22 20:00:16 espie Exp $ */
2*2e8d1edaSArun Thomas /* ex:ts=8 sw=4:
3*2e8d1edaSArun Thomas */
4*2e8d1edaSArun Thomas
5*2e8d1edaSArun Thomas /* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
6*2e8d1edaSArun Thomas *
7*2e8d1edaSArun Thomas * Permission to use, copy, modify, and distribute this software for any
8*2e8d1edaSArun Thomas * purpose with or without fee is hereby granted, provided that the above
9*2e8d1edaSArun Thomas * copyright notice and this permission notice appear in all copies.
10*2e8d1edaSArun Thomas *
11*2e8d1edaSArun Thomas * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12*2e8d1edaSArun Thomas * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13*2e8d1edaSArun Thomas * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14*2e8d1edaSArun Thomas * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15*2e8d1edaSArun Thomas * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16*2e8d1edaSArun Thomas * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17*2e8d1edaSArun Thomas * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18*2e8d1edaSArun Thomas */
19*2e8d1edaSArun Thomas
20*2e8d1edaSArun Thomas #include "ohash_int.h"
21*2e8d1edaSArun Thomas
22*2e8d1edaSArun Thomas void *
ohash_first(struct ohash * h,unsigned int * pos)23*2e8d1edaSArun Thomas ohash_first(struct ohash *h, unsigned int *pos)
24*2e8d1edaSArun Thomas {
25*2e8d1edaSArun Thomas *pos = 0;
26*2e8d1edaSArun Thomas return ohash_next(h, pos);
27*2e8d1edaSArun Thomas }
28*2e8d1edaSArun Thomas
29*2e8d1edaSArun Thomas void *
ohash_next(struct ohash * h,unsigned int * pos)30*2e8d1edaSArun Thomas ohash_next(struct ohash *h, unsigned int *pos)
31*2e8d1edaSArun Thomas {
32*2e8d1edaSArun Thomas for (; *pos < h->size; (*pos)++)
33*2e8d1edaSArun Thomas if (h->t[*pos].p != DELETED && h->t[*pos].p != NULL)
34*2e8d1edaSArun Thomas return __UNCONST(h->t[(*pos)++].p);
35*2e8d1edaSArun Thomas return NULL;
36*2e8d1edaSArun Thomas }
37