コード例 #1
0
ファイル: ll.c プロジェクト: pcostesi/c-data-structures
llist * ll_split(llist * list, ll_filter_f * f){
    llist * iter 	= list;
    llist * aux 	= NULL;
    llist * newlist = NULL;
    llist * tail 	= NULL;
	
	assert(f != NULL);
	
	if (list == NULL || f == NULL)
		return NULL;

	while (iter){
		if ((*f)(iter->val, iter->size)){
			aux = iter;
			iter = ll_next(iter);
			list = ll_remove(aux);
			tail = tail != NULL? ll_appendl(tail, aux) : aux;
		} else {
			iter = ll_next(iter);
		}
	}
	newlist = ll_head(tail);
	
    return newlist;
}
コード例 #2
0
ファイル: box-whisker.c プロジェクト: zlongshen/pspp
static void
destroy (struct statistic *s)
{
  struct box_whisker *bw = UP_CAST (s, struct box_whisker, parent.parent);
  struct order_stats *os = &bw->parent;
  struct ll *ll;

  for (ll = ll_head (&bw->outliers); ll != ll_null (&bw->outliers); )
    {
      struct outlier *e = ll_data (ll, struct outlier, ll);

      ll = ll_next (ll);

      ds_destroy (&e->label);
      free (e);
    }

  free (os->k);
  free (s);
};