kvlist: constify arguments
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
parent
d416bf6655
commit
31b3893a72
2 changed files with 9 additions and 9 deletions
8
kvlist.c
8
kvlist.c
|
@ -24,17 +24,17 @@
|
|||
|
||||
#include "kvlist.h"
|
||||
|
||||
int kvlist_strlen(struct kvlist *kv, void *data)
|
||||
int kvlist_strlen(struct kvlist *kv, const void *data)
|
||||
{
|
||||
return strlen(data) + 1;
|
||||
}
|
||||
|
||||
int kvlist_blob_len(struct kvlist *kv, void *data)
|
||||
int kvlist_blob_len(struct kvlist *kv, const void *data)
|
||||
{
|
||||
return blob_pad_len(data);
|
||||
}
|
||||
|
||||
void kvlist_init(struct kvlist *kv, int (*get_len)(struct kvlist *kv, void *data))
|
||||
void kvlist_init(struct kvlist *kv, int (*get_len)(struct kvlist *kv, const void *data))
|
||||
{
|
||||
avl_init(&kv->avl, avl_strcmp, false, NULL);
|
||||
kv->get_len = get_len;
|
||||
|
@ -71,7 +71,7 @@ bool kvlist_delete(struct kvlist *kv, const char *name)
|
|||
return !!node;
|
||||
}
|
||||
|
||||
void kvlist_set(struct kvlist *kv, const char *name, void *data)
|
||||
void kvlist_set(struct kvlist *kv, const char *name, const void *data)
|
||||
{
|
||||
struct kvlist_node *node;
|
||||
char *name_buf;
|
||||
|
|
10
kvlist.h
10
kvlist.h
|
@ -23,7 +23,7 @@
|
|||
struct kvlist {
|
||||
struct avl_tree avl;
|
||||
|
||||
int (*get_len)(struct kvlist *kv, void *data);
|
||||
int (*get_len)(struct kvlist *kv, const void *data);
|
||||
};
|
||||
|
||||
struct kvlist_node {
|
||||
|
@ -42,13 +42,13 @@ struct kvlist_node {
|
|||
value = (void *) (__avl_list_to_kv(__ptr_to_kv(value)->avl.list.next))->data, \
|
||||
name = (const char *) __ptr_to_kv(value)->avl.key)
|
||||
|
||||
void kvlist_init(struct kvlist *kv, int (*get_len)(struct kvlist *kv, void *data));
|
||||
void kvlist_init(struct kvlist *kv, int (*get_len)(struct kvlist *kv, const void *data));
|
||||
void kvlist_free(struct kvlist *kv);
|
||||
void *kvlist_get(struct kvlist *kv, const char *name);
|
||||
void kvlist_set(struct kvlist *kv, const char *name, void *data);
|
||||
void kvlist_set(struct kvlist *kv, const char *name, const void *data);
|
||||
bool kvlist_delete(struct kvlist *kv, const char *name);
|
||||
|
||||
int kvlist_strlen(struct kvlist *kv, void *data);
|
||||
int kvlist_blob_len(struct kvlist *kv, void *data);
|
||||
int kvlist_strlen(struct kvlist *kv, const void *data);
|
||||
int kvlist_blob_len(struct kvlist *kv, const void *data);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue