diff options
Diffstat (limited to 'src/common/db.c')
-rw-r--r-- | src/common/db.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/db.c b/src/common/db.c index 6506fb889..537f26e6a 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -2562,6 +2562,21 @@ void linkdb_insert( struct linkdb_node** head, void *key, void* data) node->data = data; } +void linkdb_foreach( struct linkdb_node** head, LinkDBFunc func, ... ) +{ + va_list args; + struct linkdb_node *node; + + if( head == NULL ) return; + + va_start(args, func); + node = *head; + while ( node ) { + func( node->key, node->data, args ); + node = node->next; + } +} + void* linkdb_search( struct linkdb_node** head, void *key) { int n = 0; |