Example #1
0
int main(void)
{
  struct eltpool *ep = ep_new(sizeof(struct argh), 64);
  clist l;
  clist_init(&l);
  for (uns i=0; i<65536; i++)
    {
      struct argh *a = ep_alloc(ep);
      if (i % 3)
	clist_add_tail(&l, &a->n);
      else
	clist_add_head(&l, &a->n);
      if (!(i % 5))
	{
	  a = clist_head(&l);
	  clist_remove(&a->n);
	  ep_free(ep, a);
	}
    }
  ep_delete(ep);
  puts("OK");
  return 0;
}
Example #2
0
void cmem_link_next(stMEMGINFO *pMEMGINFO, U8 *pHead, U8 *pNew)
{
	clist_add_head(pMEMGINFO, &(((st_sidb_node *)pNew)->list), &(((st_sidb_node *)pHead)->list));
}