summaryrefslogtreecommitdiffstats
path: root/utils.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-06-24 23:58:37 +0200
committerFelix Fietkau <nbd@openwrt.org>2012-06-24 23:58:37 +0200
commit4bff1b5ebcffc1488649199b88d3602184edf7f3 (patch)
tree0942dc6a6c0c4590ff33ef26af7e38e6d0f0d38a /utils.c
parent43dec9ddfc926aaa884ecf939f8344e960805528 (diff)
downloadunitd-4bff1b5ebcffc1488649199b88d3602184edf7f3.tar
unitd-4bff1b5ebcffc1488649199b88d3602184edf7f3.zip
fix env var handling, add support for filling blobmsg_list from arrays
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/utils.c b/utils.c
index 88ed8c1..0f9ce74 100644
--- a/utils.c
+++ b/utils.c
@@ -11,7 +11,7 @@ __blobmsg_list_init(struct blobmsg_list *list, int offset, int len)
}
int
-blobmsg_list_fill(struct blobmsg_list *list, void *data, int len)
+blobmsg_list_fill(struct blobmsg_list *list, void *data, int len, bool array)
{
struct avl_tree *tree = &list->avl;
struct blobmsg_list_node *node;
@@ -29,7 +29,10 @@ blobmsg_list_fill(struct blobmsg_list *list, void *data, int len)
return -1;
node = (void *) ((char *)ptr + list->node_offset);
- node->avl.key = blobmsg_name(cur);
+ if (array)
+ node->avl.key = blobmsg_data(cur);
+ else
+ node->avl.key = blobmsg_name(cur);
node->data = cur;
if (avl_insert(tree, &node->avl)) {
free(ptr);