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.
This commit is contained in:
parent
5fd7dacadc
commit
3c09af4169
1 changed files with 6 additions and 2 deletions
|
@ -244,9 +244,13 @@ int_set_add(struct linpool *pool, struct adata *list, u32 val)
|
||||||
len = list ? list->length : 0;
|
len = list ? list->length : 0;
|
||||||
res = lp_alloc(pool, sizeof(struct adata) + len + 4);
|
res = lp_alloc(pool, sizeof(struct adata) + len + 4);
|
||||||
res->length = len + 4;
|
res->length = len + 4;
|
||||||
* (u32 *) res->data = val;
|
|
||||||
if (list)
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue