refactor: split up the utilities file into smaller modules
This commit is contained in:
parent
abaa6e12fc
commit
ff71a92249
13 changed files with 572 additions and 488 deletions
24
include/list.h
Normal file
24
include/list.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue