Revision 261816b0

View differences:

nest/a-set.c
231 231
  return 0;
232 232
}
233 233

  
234
struct adata *
235
int_set_prepend(struct linpool *pool, struct adata *list, u32 val)
236
{
237
  struct adata *res;
238
  int len;
239

  
240
  if (int_set_contains(list, val))
241
    return list;
242

  
243
  len = list ? list->length : 0;
244
  res = lp_alloc(pool, sizeof(struct adata) + len + 4);
245
  res->length = len + 4;
246

  
247
  if (list)
248
    memcpy(res->data + 4, list->data, list->length);
249

  
250
  * (u32 *) res->data = val;
251

  
252
  return res;
253
}
234 254

  
235 255
struct adata *
236 256
int_set_add(struct linpool *pool, struct adata *list, u32 val)
......
248 268
  if (list)
249 269
    memcpy(res->data, list->data, list->length);
250 270

  
251
  u32 *c = (u32 *) (res->data + len);
252
  *c = val;
271
  * (u32 *) (res->data + len) = val;
253 272

  
254 273
  return res;
255 274
}
nest/attrs.h
132 132
int int_set_contains(struct adata *list, u32 val);
133 133
int ec_set_contains(struct adata *list, u64 val);
134 134
int lc_set_contains(struct adata *list, lcomm val);
135
struct adata *int_set_prepend(struct linpool *pool, struct adata *list, u32 val);
135 136
struct adata *int_set_add(struct linpool *pool, struct adata *list, u32 val);
136 137
struct adata *ec_set_add(struct linpool *pool, struct adata *list, u64 val);
137 138
struct adata *lc_set_add(struct linpool *pool, struct adata *list, lcomm val);
proto/bgp/attrs.c
1077 1077
bgp_cluster_list_prepend(rte *e, ea_list **attrs, struct linpool *pool, u32 cid)
1078 1078
{
1079 1079
  eattr *a = ea_find(e->attrs->eattrs, EA_CODE(EAP_BGP, BA_CLUSTER_LIST));
1080
  bgp_attach_attr(attrs, pool, BA_CLUSTER_LIST, (uintptr_t) int_set_add(pool, a ? a->u.ptr : NULL, cid));
1080
  bgp_attach_attr(attrs, pool, BA_CLUSTER_LIST, (uintptr_t) int_set_prepend(pool, a ? a->u.ptr : NULL, cid));
1081 1081
}
1082 1082

  
1083 1083
static int

Also available in: Unified diff