Tinyhash
This is a library containing multiple C implementations of hashmap.
Loading...
Searching...
No Matches
Functions
iterator.c File Reference
#include <stdlib.h>
#include "iterator.h"
Include dependency graph for iterator.c:

Go to the source code of this file.

Functions

static void th_iterator_init (th_iterator_t *it, th_generic_table_t generic_table, th_iterator_next_func_t next)
 
th_iterator_tth_iterator_create (th_generic_table_t generic_table, th_iterator_next_func_t next)
 Allocate then init a new iterator.
 
void th_iterator_free (th_iterator_t *it)
 Free an iterator.
 
bool th_iterator_next (th_iterator_t **ptr)
 Try to get the next element. Free the iterator if it reachs the end.
 

Function Documentation

◆ th_iterator_create()

th_iterator_t * th_iterator_create ( th_generic_table_t generic_table,
th_iterator_next_func_t next )

Allocate then init a new iterator.

Parameters
generic_table
next
Returns
th_iterator_t*

Definition at line 16 of file iterator.c.

References th_iterator_init().

Referenced by th_oa_iterator_begin(), and th_sc_iterator_begin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ th_iterator_free()

void th_iterator_free ( th_iterator_t * it)

Free an iterator.

Parameters
it

Definition at line 29 of file iterator.c.

References th_iterator_init().

Referenced by th_iterator_next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ th_iterator_init()

static void th_iterator_init ( th_iterator_t * it,
th_generic_table_t generic_table,
th_iterator_next_func_t next )
static

Definition at line 5 of file iterator.c.

References th_iterator_s::current, th_iterator_s::generic_table, th_iterator_s::index, th_iterator_s::key, th_iterator_s::next, and th_iterator_s::value.

Referenced by th_iterator_create(), and th_iterator_free().

Here is the caller graph for this function:

◆ th_iterator_next()

bool th_iterator_next ( th_iterator_t ** ptr)

Try to get the next element. Free the iterator if it reachs the end.

Parameters
ptr
Returns
true
false

Definition at line 35 of file iterator.c.

References th_iterator_s::next, and th_iterator_free().

Here is the call graph for this function: