-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnode.h
More file actions
30 lines (25 loc) · 821 Bytes
/
node.h
File metadata and controls
30 lines (25 loc) · 821 Bytes
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
#ifndef NODE_H__
#define NODE_H__
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Node Node;
typedef Node *(*node_func)(Node *);
typedef void *(*node_data_alloc_func)(size_t n_items, size_t item_size_bytes);
typedef void (*node_data_dealloc_func)(void *item);
typedef enum SLL_Result
{
SLL_SUCCESS,
SLL_FAIL
} SLL_Result;
Node *create_node(void);
Node *destroy_node(Node *node);
void *get_node_data(Node *node);
SLL_Result fill_node_data(Node *node, unsigned int size, void *data);
void clear_node_data(Node *node);
Node *get_next_node(Node *node);
SLL_Result append_node(Node *node, unsigned size, void *data);
void set_node_data_alloc_dealloc_func(node_data_alloc_func alloc_fptr, node_data_dealloc_func dealloc_fptr);
#endif // NODE_H__