diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-06-24 18:38:54 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-06-24 18:38:54 +0200 |
commit | 063b8c2b5301646335dac66f1167bc8f128537a7 (patch) | |
tree | ce1614439ef9a6c1798c186501bcb9cead652daf | |
parent | 480c24c6df4446ba484228ecf3212fc6144a54bc (diff) | |
download | unitd-063b8c2b5301646335dac66f1167bc8f128537a7.tar unitd-063b8c2b5301646335dac66f1167bc8f128537a7.zip |
add blobmsg_list_move
-rw-r--r-- | utils.c | 14 | ||||
-rw-r--r-- | utils.h | 1 |
2 files changed, 15 insertions, 0 deletions
@@ -43,6 +43,20 @@ blobmsg_list_fill(struct blobmsg_list *list, void *data, int len) } void +blobmsg_list_move(struct blobmsg_list *list, struct blobmsg_list *src) +{ + struct blobmsg_list_node *node, *tmp; + void *ptr; + + avl_remove_all_elements(&src->avl, node, avl, tmp) { + if (!avl_insert(&list->avl, &node->avl)) { + ptr = ((char *) node - list->node_offset); + free(ptr); + } + } +} + +void blobmsg_list_free(struct blobmsg_list *list) { struct blobmsg_list_node *node, *tmp; @@ -26,5 +26,6 @@ void __blobmsg_list_init(struct blobmsg_list *list, int offset, int len); int blobmsg_list_fill(struct blobmsg_list *list, void *data, int len); void blobmsg_list_free(struct blobmsg_list *list); bool blobmsg_list_equal(struct blobmsg_list *l1, struct blobmsg_list *l2); +void blobmsg_list_move(struct blobmsg_list *list, struct blobmsg_list *src); #endif |