summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slist.h14
-rw-r--r--test/test_slist.c20
2 files changed, 1 insertions, 33 deletions
diff --git a/slist.h b/slist.h
index 07f2862..146b6d7 100644
--- a/slist.h
+++ b/slist.h
@@ -189,19 +189,12 @@ slist_insert_tail(struct slist *list, struct slist_node *node)
/*
* Insert a node after another node.
*
- * The prev argument is used to determine the insertion point. It may safely
- * denote the end of the given list, in which case the node is inserted at
- * the head of the list.
+ * The prev node must be valid.
*/
static inline void
slist_insert_after(struct slist *list, struct slist_node *prev,
struct slist_node *node)
{
- if (slist_end(prev)) {
- slist_insert_head(list, node);
- return;
- }
-
node->next = prev->next;
prev->next = node;
@@ -393,11 +386,6 @@ static inline void
slist_llsync_insert_after(struct slist *list, struct slist_node *prev,
struct slist_node *node)
{
- if (slist_end(prev)) {
- slist_llsync_insert_head(list, node);
- return;
- }
-
node->next = prev->next;
llsync_assign_ptr(prev->next, node);
diff --git a/test/test_slist.c b/test/test_slist.c
index 941b80f..df3051e 100644
--- a/test/test_slist.c
+++ b/test/test_slist.c
@@ -66,24 +66,6 @@ add_obj_head_llsync(struct slist *list)
}
static void
-add_obj_head2(struct slist *list)
-{
- struct obj *obj;
-
- obj = obj_create();
- slist_insert_after(list, NULL, &obj->node);
-}
-
-static void
-add_obj_head2_llsync(struct slist *list)
-{
- struct obj *obj;
-
- obj = obj_create();
- slist_llsync_insert_after(list, NULL, &obj->node);
-}
-
-static void
add_obj_tail(struct slist *list)
{
struct obj *obj;
@@ -324,8 +306,6 @@ main(void)
add_obj_head(&list);
add_obj_head(&list);
add_obj_head(&list);
- add_obj_head2(&list);
- add_obj_head2_llsync(&list);
add_obj_tail2(&list);
add_obj_tail2_llsync(&list);