We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02790d7 commit 50fae77Copy full SHA for 50fae77
src/lib/inc/list.h
@@ -118,6 +118,24 @@ static inline bool list_rm(struct list* list, node_t* node)
118
return true;
119
}
120
121
+static inline size_t list_size(struct list* list)
122
+{
123
+ size_t size = 0;
124
+ if (list != NULL) {
125
+ spin_lock(&list->lock);
126
+
127
+ node_t* temp = list->head;
128
+ while (temp != NULL) {
129
+ size++;
130
+ temp = *temp;
131
+ }
132
133
+ spin_unlock(&list->lock);
134
135
136
+ return size;
137
+}
138
139
typedef int (*node_cmp_t)(node_t*, node_t*);
140
141
static inline void list_insert_ordered(struct list* list, node_t* node, node_cmp_t cmp)
0 commit comments