* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 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
*
***************************************************************************/
-#include "setup.h"
-
-#include <string.h>
-#include <stdlib.h>
+#include "curl_setup.h"
#include "llist.h"
#include "curl_memory.h"
/* this must be the last include file */
#include "memdebug.h"
+/*
+ * @unittest: 1300
+ */
static void
llist_init(struct curl_llist *l, curl_llist_dtor dtor)
{
struct curl_llist *list;
list = malloc(sizeof(struct curl_llist));
- if(NULL == list)
+ if(!list)
return NULL;
llist_init(list, dtor);
* inserted first in the list.
*
* Returns: 1 on success and 0 on failure.
+ *
+ * @unittest: 1300
*/
int
Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,
return 1;
}
+/*
+ * @unittest: 1300
+ */
int
Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
void *user)
list->tail = NULL;
else
e->next->prev = NULL;
- } else {
+ }
+ else {
e->prev->next = e->next;
if(!e->next)
list->tail = e->prev;
list->dtor(user, e->ptr);
+ e->ptr = NULL;
+ e->prev = NULL;
+ e->next = NULL;
+
free(e);
--list->size;
return list->size;
}
+/*
+ * @unittest: 1300
+ */
int Curl_llist_move(struct curl_llist *list, struct curl_llist_element *e,
- struct curl_llist *to_list, struct curl_llist_element *to_e)
+ struct curl_llist *to_list,
+ struct curl_llist_element *to_e)
{
/* Remove element from list */
if(e == NULL || list->size == 0)