aboutsummaryrefslogtreecommitdiff
path: root/lib/llist.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-04-20 15:10:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-04-22 11:25:27 +0200
commitcbae73e1dd95946597ea74ccb580c30f78e3fa73 (patch)
tree56697b9325403031bb2fcfc6a723719b9819b0be /lib/llist.h
parentcbb59ed9ce9555e0dc0b485247fe86f0e45006b3 (diff)
llist: no longer uses malloc
The 'list element' struct now has to be within the data that is being added to the list. Removes 16.6% (tiny) mallocs from a simple HTTP transfer. (96 => 80) Also removed return codes since the llist functions can't fail now. Test 1300 updated accordingly. Closes #1435
Diffstat (limited to 'lib/llist.h')
-rw-r--r--lib/llist.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/llist.h b/lib/llist.h
index 47935ad1f..6b644b99c 100644
--- a/lib/llist.h
+++ b/lib/llist.h
@@ -29,7 +29,6 @@ typedef void (*curl_llist_dtor)(void *, void *);
struct curl_llist_element {
void *ptr;
-
struct curl_llist_element *prev;
struct curl_llist_element *next;
};
@@ -37,21 +36,19 @@ struct curl_llist_element {
struct curl_llist {
struct curl_llist_element *head;
struct curl_llist_element *tail;
-
curl_llist_dtor dtor;
-
size_t size;
};
void Curl_llist_init(struct curl_llist *, curl_llist_dtor);
-int Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *,
- const void *);
-int Curl_llist_remove(struct curl_llist *, struct curl_llist_element *,
- void *);
+void Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *,
+ const void *, struct curl_llist_element *node);
+void Curl_llist_remove(struct curl_llist *, struct curl_llist_element *,
+ void *);
size_t Curl_llist_count(struct curl_llist *);
void Curl_llist_destroy(struct curl_llist *, void *);
-int Curl_llist_move(struct curl_llist *, struct curl_llist_element *,
- struct curl_llist *, struct curl_llist_element *);
+void Curl_llist_move(struct curl_llist *, struct curl_llist_element *,
+ struct curl_llist *, struct curl_llist_element *);
#endif /* HEADER_CURL_LLIST_H */