aboutsummaryrefslogtreecommitdiff
path: root/lib/list.h
blob: 18bc423838286fcccb949e25e7d164714022a852 (plain)
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
#pragma once
#include <stdlib.h>

#define LIST_SIZE_FACTOR 1.5
struct list
{
    unsigned int size;
    unsigned int allocated_size;
    void** list;
};

typedef struct list LIST;

/**
* Add an item to a list
* @list: array list structure.
* @item: item to be added to the list.
*/
LIST* list_add(LIST* list, void* item);

/**
* Remove an item from a given list
* @list: array list structure.
* @pos: position of item to be removed.
*/
LIST *list_remove(LIST *list, unsigned int pos);

void list_free(LIST* list);

void *list_get(LIST *list, unsigned int index);