libtransistor
A userland library for the Nintendo Switch
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
include
libtransistor
collections
list.h
Go to the documentation of this file.
1
7
#pragma once
8
9
#include<stddef.h>
10
11
#ifdef __cplusplus
12
extern
"C"
{
13
#endif
14
15
typedef
struct
trn_list_head_t
trn_list_head_t
;
16
struct
trn_list_head_t
{
17
trn_list_head_t
*prev;
18
trn_list_head_t
*next;
19
};
20
21
#define TRN_LIST_HEAD_INITIALIZER {.prev = NULL, .next = NULL}
22
23
#define trn_list_entry(type, field, head) ((type*) (((void*) (head)) - offsetof(type, field)))
24
25
inline
void
trn_list_add_tail(
trn_list_head_t
*list,
trn_list_head_t
*item) {
26
while
(list->next != NULL) {
27
list = list->next;
28
}
29
list->next = item;
30
item->prev = list;
31
item->next = NULL;
32
}
33
34
inline
void
trn_list_delink(
trn_list_head_t
*item) {
35
if
(item->prev != NULL) {
36
item->prev->next = item->next;
37
}
38
if
(item->next != NULL) {
39
item->next->prev = item->prev;
40
}
41
}
42
43
#define trn_list_foreach(list, i) for(trn_list_head_t *i = (list)->next; i != NULL; i = i->next)
44
45
#ifdef __cplusplus
46
}
47
#endif
trn_list_head_t
Definition:
list.h:16
Generated on Thu Oct 3 2019 01:41:37 for libtransistor by
1.8.6