dict: Add lif_dict_find_all().
As a dict can have multiple values for any given key we add a function to query all occurences of a given key and return them as a (new) list. Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
cb9d347c8a
commit
b1dfa609f9
2 changed files with 28 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
* Purpose: wrapping linked lists to provide a naive dictionary
|
||||
*
|
||||
* Copyright (c) 2020 Ariadne Conill <ariadne@dereferenced.org>
|
||||
* Copyright (c) 2020 Maximilian Wilhelm <max@sdn.clinic>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -38,6 +39,7 @@ extern void lif_dict_init(struct lif_dict *dict);
|
|||
extern void lif_dict_fini(struct lif_dict *dict);
|
||||
extern struct lif_dict_entry *lif_dict_add(struct lif_dict *dict, const char *key, void *data);
|
||||
extern struct lif_dict_entry *lif_dict_find(struct lif_dict *dict, const char *key);
|
||||
extern struct lif_list *lif_dict_find_all(struct lif_dict *dict, const char *key);
|
||||
extern void lif_dict_delete(struct lif_dict *dict, const char *key);
|
||||
extern void lif_dict_delete_entry(struct lif_dict *dict, struct lif_dict_entry *entry);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue