gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnurl] 57/282: llist: removed unused Curl_llist_move()


From: gnunet
Subject: [gnurl] 57/282: llist: removed unused Curl_llist_move()
Date: Wed, 01 Apr 2020 14:28:42 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit c0d7b05c41cc58144d78db022212b8d4d248c9bf
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Jan 23 09:15:39 2020 +0100

    llist: removed unused Curl_llist_move()
    
    (and the corresponding unit test)
    
    Closes #4842
---
 lib/llist.c           | 53 +--------------------------------------------------
 lib/llist.h           |  5 +----
 tests/unit/unit1300.c | 52 +-------------------------------------------------
 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, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <address@hidden>, 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, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <address@hidden>, 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, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <address@hidden>, 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);
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]