dict: lif_dict_find() + lif_dict_find_all() do not touch the dict, so mark it const.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2020-10-14 01:39:31 +02:00
parent 02324bebd5
commit a72d87df0b
2 changed files with 4 additions and 4 deletions

View file

@ -86,7 +86,7 @@ lif_dict_add_once(struct lif_dict *dict, const char *key, void *data,
} }
struct lif_dict_entry * struct lif_dict_entry *
lif_dict_find(struct lif_dict *dict, const char *key) lif_dict_find(const struct lif_dict *dict, const char *key)
{ {
struct lif_node *iter; struct lif_node *iter;
@ -102,7 +102,7 @@ lif_dict_find(struct lif_dict *dict, const char *key)
} }
struct lif_list * struct lif_list *
lif_dict_find_all(struct lif_dict *dict, const char *key) lif_dict_find_all(const struct lif_dict *dict, const char *key)
{ {
struct lif_list *entries = calloc(1, sizeof *entries); struct lif_list *entries = calloc(1, sizeof *entries);
struct lif_node *iter; struct lif_node *iter;

View file

@ -44,8 +44,8 @@ extern void lif_dict_init(struct lif_dict *dict);
extern void lif_dict_fini(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_add(struct lif_dict *dict, const char *key, void *data);
extern struct lif_dict_entry *lif_dict_add_once(struct lif_dict *dict, const char *key, void *data, lif_dict_cmp_t compar); extern struct lif_dict_entry *lif_dict_add_once(struct lif_dict *dict, const char *key, void *data, lif_dict_cmp_t compar);
extern struct lif_dict_entry *lif_dict_find(struct lif_dict *dict, const char *key); extern struct lif_dict_entry *lif_dict_find(const struct lif_dict *dict, const char *key);
extern struct lif_list *lif_dict_find_all(struct lif_dict *dict, const char *key); extern struct lif_list *lif_dict_find_all(const struct lif_dict *dict, const char *key);
extern void lif_dict_delete(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); extern void lif_dict_delete_entry(struct lif_dict *dict, struct lif_dict_entry *entry);