#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;
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;
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 {
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