src/server/ucx/dlist.h

Sat, 19 Jan 2013 20:13:07 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 19 Jan 2013 20:13:07 +0100
changeset 48
37a512d7b8f6
parent 36
450d2d5f4735
child 71
069c152f6272
permissions
-rw-r--r--

fixed some memory leaks

/* 
 * 
 */

#ifndef DLIST_H
#define	DLIST_H

#include "ucx.h"
#include <stddef.h>

#ifdef	__cplusplus
extern "C" {
#endif

typedef struct UcxDlist UcxDlist;
struct UcxDlist {
    void     *data;
    UcxDlist *next;
    UcxDlist *prev;
};

UcxDlist *ucx_dlist_clone(UcxDlist *l, copy_func fnc, void* data);
int ucx_dlist_equals(UcxDlist *l1, UcxDlist *l2, cmp_func fnc, void* data);

void ucx_dlist_free(UcxDlist *l);
UcxDlist *ucx_dlist_append(UcxDlist *l, void *data);
UcxDlist *ucx_dlist_prepend(UcxDlist *l, void *data);
UcxDlist *ucx_dlist_concat(UcxDlist *l1, UcxDlist *l2);
UcxDlist *ucx_dlist_last(UcxDlist *l);
UcxDlist *ucx_dlist_get(UcxDlist *l, int index);
size_t ucx_dlist_size(UcxDlist *l);

UcxDlist *ucx_dlist_sort(UcxDlist *l, cmp_func fnc, void *data);

/* dlist specific functions */
UcxDlist *ucx_dlist_first(UcxDlist *l);
UcxDlist *ucx_dlist_remove(UcxDlist *l, UcxDlist *e);

#ifdef	__cplusplus
}
#endif

#endif	/* DLIST_H */

mercurial