summaryrefslogtreecommitdiffstats
path: root/lib/linkedlist.h
blob: 26c148e17000dd1590d0e486430b9acacb8e3d03 (plain) (blame)
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
#ifndef JOVE_LIB_LINKEDLIST_H
#define JOVE_LIB_LINKEDLIST_H 1

#include <stdint.h>
#include <stddef.h>

struct SLLNode {
    struct SLLNode *next;
    char data[];
};

/*Singly Linked List*/
struct SLinkedList
{
    struct SLLNode *head;
    struct SLLNode *tail;
    
    size_t obj_size;
    size_t count;
};

void sll_new(struct SLinkedList *list, size_t obj_size);
void sll_push(struct SLinkedList *list, void *node);
void *sll_get(struct SLinkedList *list, size_t index);

#endif