Revision 4847a894 nest/a-set.c

View differences:

nest/a-set.c
40 40
struct adata *
41 41
int_set_add(struct linpool *pool, struct adata *list, u32 val)
42 42
{
43
  struct adata *res = lp_alloc(pool, list->length + sizeof(struct adata) + 4);
44
  res->length = list->length+4;
43
  int len = list ? list->length : 0;
44
  struct adata *res = lp_alloc(pool, len + sizeof(struct adata) + 4);
45
  res->length = len + 4;
45 46
  * (u32 *) res->data = val;
46
  memcpy((char *) res->data + 4, list->data, list->length);
47
  if (list)
48
    memcpy((char *) res->data + 4, list->data, list->length);
47 49
  return res;
48 50
}
49 51

  

Also available in: Unified diff