summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-01-23 09:15:39 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-01-23 09:15:39 +0100
commit5be2c45abc061b3f5d29c14ed97099e4f5a50058 (patch)
tree928b1e73db17c76020f0ec4004fdcdfcc12415ff
parentab7ec68f1fde17d62357fbfcefc305e8c3325995 (diff)
downloadcurl-bagder/static-functions.tar.gz
llist: removed unused Curl_llist_move()bagder/static-functions
(and the corresponding unit test)
-rw-r--r--lib/llist.c53
-rw-r--r--lib/llist.h5
-rw-r--r--tests/unit/unit1300.c52
3 files changed, 3 insertions, 107 deletions
diff --git a/lib/llist.c b/lib/llist.c
index f8769c2af..e7c6f51dc 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, 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
@@ -144,54 +144,3 @@ Curl_llist_count(struct curl_llist *list)
{
return list->size;
}
-
-/*
- * @unittest: 1300
- */
-void Curl_llist_move(struct curl_llist *list, struct curl_llist_element *e,
- struct curl_llist *to_list,
- struct curl_llist_element *to_e)
-{
- /* Remove element from list */
- if(e == NULL || list->size == 0)
- return;
-
- if(e == list->head) {
- list->head = e->next;
-
- if(list->head == NULL)
- list->tail = NULL;
- else
- e->next->prev = NULL;
- }
- else {
- e->prev->next = e->next;
- if(!e->next)
- list->tail = e->prev;
- else
- e->next->prev = e->prev;
- }
-
- --list->size;
-
- /* Add element to to_list after to_e */
- if(to_list->size == 0) {
- to_list->head = e;
- to_list->head->prev = NULL;
- to_list->head->next = NULL;
- to_list->tail = e;
- }
- else {
- e->next = to_e->next;
- e->prev = to_e;
- if(to_e->next) {
- to_e->next->prev = e;
- }
- else {
- to_list->tail = e;
- }
- to_e->next = e;
- }
-
- ++to_list->size;
-}
diff --git a/lib/llist.h b/lib/llist.h
index a5e2ecbfb..0178c4259 100644
--- a/lib/llist.h
+++ b/lib/llist.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, 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
@@ -47,7 +47,4 @@ 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 *);
-void Curl_llist_move(struct curl_llist *, struct curl_llist_element *,
- struct curl_llist *, struct curl_llist_element *);
-
#endif /* HEADER_CURL_LLIST_H */
diff --git a/tests/unit/unit1300.c b/tests/unit/unit1300.c
index 5cfa6daf3..5d8799779 100644
--- a/tests/unit/unit1300.c
+++ b/tests/unit/unit1300.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, 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
@@ -54,7 +54,6 @@ UNITTEST_START
struct curl_llist_element case2_list;
struct curl_llist_element case3_list;
struct curl_llist_element case4_list;
- struct curl_llist_element case5_list;
struct curl_llist_element *head;
struct curl_llist_element *element_next;
struct curl_llist_element *element_prev;
@@ -216,55 +215,6 @@ UNITTEST_START
fail_unless(llist.tail == NULL,
"llist tail is not NULL while the llist is empty");
- /* @testing Curl_llist_move(struct curl_llist *,
- * struct curl_llist_element *, struct curl_llist *,
- * struct curl_llist_element *);
- */
-
- /**
- * @case 1:
- * moving head from an llist containing one element to an empty llist
- * @assumptions:
- * 1: llist size will be 0
- * 2: llist_destination size will be 1
- * 3: llist head will be NULL
- * 4: llist_destination head == llist_destination tail != NULL
- */
-
- /*
- * @setup
- * add one element to the list
- */
-
- Curl_llist_insert_next(&llist, llist.head, &unusedData_case1,
- &case5_list);
- /* necessary assertions */
-
- abort_unless(Curl_llist_count(&llist) == 1,
- "Number of list elements is not as expected, Aborting");
- abort_unless(Curl_llist_count(&llist_destination) == 0,
- "Number of list elements is not as expected, Aborting");
-
- /*actual testing code*/
- Curl_llist_move(&llist, llist.head, &llist_destination, NULL);
- fail_unless(Curl_llist_count(&llist) == 0,
- "moving element from llist didn't decrement the size");
-
- fail_unless(Curl_llist_count(&llist_destination) == 1,
- "moving element to llist_destination didn't increment the size");
-
- fail_unless(llist.head == NULL,
- "llist head not set to null after moving the head");
-
- fail_unless(llist_destination.head != NULL,
- "llist_destination head set to null after moving an element");
-
- fail_unless(llist_destination.tail != NULL,
- "llist_destination tail set to null after moving an element");
-
- fail_unless(llist_destination.tail == llist_destination.head,
- "llist_destination tail doesn't equal llist_destination head");
-
Curl_llist_destroy(&llist, NULL);
Curl_llist_destroy(&llist_destination, NULL);
}