-
Notifications
You must be signed in to change notification settings - Fork 6
/
list.h
31 lines (27 loc) · 792 Bytes
/
list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// list.h
// adjacencylist
//
// Created by Sam Goldman on 6/21/11.
// Copyright 2011 Sam Goldman. All rights reserved.
//
typedef void (*node_data_free_callback_t)(void *);
typedef struct Node {
void *data;
struct Node *next;
} Node;
typedef struct List {
Node *head;
int count;
node_data_free_callback_t node_data_free_callback;
int (*cmp)(const void *a, const void *b);
} List;
List *list_create(node_data_free_callback_t node_data_free_callback,int (*cmp)(const void *a, const void *b));
void list_add_data(List *list, void *data);
void list_add_data_sorted(List *list, void *data);
void list_remove_data(List *list, void *data);
int list_pop_front(List *list);
void *shift(List *list);
int list_empty(List *list);
void list_free(List *list);
void list_sort(List *list);