summaryrefslogtreecommitdiff
path: root/nest/a-set.c
diff options
context:
space:
mode:
authorPavel Tvrdik <pawel.tvrdik@gmail.com>2016-10-13 16:57:21 +0200
committerPavel Tvrdik <pawel.tvrdik@gmail.com>2016-10-13 16:59:15 +0200
commit3c09af416939d26c252aa1b339b52fd8f9f8e774 (patch)
treef9e5ff8253534ced19f48d8150c74f40757754c6 /nest/a-set.c
parent5fd7dacadc3cd8f91f66cb56e3a9ef81028aa102 (diff)
Clist: The add() function will append a new value
The add() function used to prepend a new community to clist, but after this fix the add() function appends new community.
Diffstat (limited to 'nest/a-set.c')
-rw-r--r--nest/a-set.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nest/a-set.c b/nest/a-set.c
index fde34cab..bd244e2e 100644
--- a/nest/a-set.c
+++ b/nest/a-set.c
@@ -244,9 +244,13 @@ int_set_add(struct linpool *pool, struct adata *list, u32 val)
len = list ? list->length : 0;
res = lp_alloc(pool, sizeof(struct adata) + len + 4);
res->length = len + 4;
- * (u32 *) res->data = val;
+
if (list)
- memcpy((char *) res->data + 4, list->data, list->length);
+ memcpy(res->data, list->data, list->length);
+
+ u32 *c = (u32 *) (res->data + len);
+ *c = val;
+
return res;
}