24 lines
No EOL
514 B
C
24 lines
No EOL
514 B
C
#ifndef LIST_H
|
|
#define LIST_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define LIST_INIT_CAPACITY 4
|
|
|
|
typedef struct {
|
|
void** items;
|
|
size_t len;
|
|
size_t capacity;
|
|
size_t item_size;
|
|
} List;
|
|
|
|
List* list_new(size_t item_size);
|
|
int list_push(List*, void*);
|
|
int list_remove(List*, const void*, int (*compare)(const void*, const void*));
|
|
void list_free(List*);
|
|
void* list_binary_search(List*, const void*, int (*compare)(const void*, const void*));
|
|
|
|
#endif // LIST_H
|