summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/llist.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmcurl/llist.c')
-rw-r--r--Utilities/cmcurl/llist.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/Utilities/cmcurl/llist.c b/Utilities/cmcurl/llist.c
index 90ac1c8..921d1d1 100644
--- a/Utilities/cmcurl/llist.c
+++ b/Utilities/cmcurl/llist.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -27,13 +27,13 @@
#include <stdlib.h>
#include "llist.h"
-#include "curl_memory.h"
+#include "memory.h"
/* this must be the last include file */
#include "memdebug.h"
void
-Curl_llist_init(curl_llist *l, curl_llist_dtor dtor)
+Curl_llist_init(struct curl_llist *l, curl_llist_dtor dtor)
{
l->size = 0;
l->dtor = dtor;
@@ -41,12 +41,12 @@ Curl_llist_init(curl_llist *l, curl_llist_dtor dtor)
l->tail = NULL;
}
-curl_llist *
+struct curl_llist *
Curl_llist_alloc(curl_llist_dtor dtor)
{
- curl_llist *list;
+ struct curl_llist *list;
- list = (curl_llist *)malloc(sizeof(curl_llist));
+ list = (struct curl_llist *)malloc(sizeof(struct curl_llist));
if(NULL == list)
return NULL;
@@ -59,10 +59,11 @@ Curl_llist_alloc(curl_llist_dtor dtor)
* Curl_llist_insert_next() returns 1 on success and 0 on failure.
*/
int
-Curl_llist_insert_next(curl_llist *list, curl_llist_element *e, const void *p)
+Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,
+ const void *p)
{
- curl_llist_element *ne =
- (curl_llist_element *) malloc(sizeof(curl_llist_element));
+ struct curl_llist_element *ne =
+ (struct curl_llist_element *) malloc(sizeof(struct curl_llist_element));
if(!ne)
return 0;
@@ -91,7 +92,8 @@ Curl_llist_insert_next(curl_llist *list, curl_llist_element *e, const void *p)
}
int
-Curl_llist_remove(curl_llist *list, curl_llist_element *e, void *user)
+Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
+ void *user)
{
if (e == NULL || list->size == 0)
return 1;
@@ -119,7 +121,7 @@ Curl_llist_remove(curl_llist *list, curl_llist_element *e, void *user)
}
void
-Curl_llist_destroy(curl_llist *list, void *user)
+Curl_llist_destroy(struct curl_llist *list, void *user)
{
if(list) {
while (list->size > 0)
@@ -128,3 +130,9 @@ Curl_llist_destroy(curl_llist *list, void *user)
free(list);
}
}
+
+size_t
+Curl_llist_count(struct curl_llist *list)
+{
+ return list->size;
+}