summaryrefslogtreecommitdiff
path: root/cesar/lib
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/lib')
-rw-r--r--cesar/lib/list.h38
-rw-r--r--cesar/lib/src/list.c16
-rw-r--r--cesar/lib/src/slab.c4
-rw-r--r--cesar/lib/src/trace.c4
-rw-r--r--cesar/lib/test/list/src/test_list.c17
5 files changed, 40 insertions, 39 deletions
diff --git a/cesar/lib/list.h b/cesar/lib/list.h
index 042236ac65..b85db10c12 100644
--- a/cesar/lib/list.h
+++ b/cesar/lib/list.h
@@ -104,36 +104,36 @@ bool
list_empty (list_t *list);
/**
- * Push a node to the end of a list.
+ * Push a node to the back (end) of a list.
* \param list the list
* \param node the node to push
*/
void
-list_push (list_t *list, list_node_t *node);
+list_push_back (list_t *list, list_node_t *node);
/**
- * Unshift a node to the begin of a list.
+ * Push a node to the front of a list.
* \param list the list
- * \param node the node to unshift
+ * \param node the node to push
*/
void
-list_unshift (list_t *list, list_node_t *node);
+list_push_front (list_t *list, list_node_t *node);
/**
- * Pop a node from the end of a list.
+ * Pop a node from the back (end) of a list.
* \param list the list
* \return the popped node
*/
list_node_t *
-list_pop (list_t *list);
+list_pop_back (list_t *list);
/**
- * Shift a node from the begin of a list.
+ * Pop a node from the front of a list.
* \param list the list
- * \return the shifted node
+ * \return the popped node
*/
list_node_t *
-list_shift (list_t *list);
+list_pop_front (list_t *list);
/**
* Remove a node from a list.
@@ -153,26 +153,26 @@ void
list_insert (list_t *list, list_node_t *before, list_node_t *node);
/**
- * Push a range [first, last) to a end of a list.
+ * Push a range [first, last) to the back (end) of a list.
* \param to list to push to
* \param from list to remove from
* \param first first node to push
* \param last node after the last one to push
*/
void
-list_push_range (list_t *to, list_t *from,
- list_node_t *first, list_node_t *last);
+list_push_back_range (list_t *to, list_t *from,
+ list_node_t *first, list_node_t *last);
/**
- * Unshift a range [first, last) to a begin of a list.
- * \param to list to unshift to
+ * Push a range [first, last) to the front of a list.
+ * \param to list to push to
* \param from list to remove from
- * \param first first node to unshift
- * \param last node after the last one to unshift
+ * \param first first node to push
+ * \param last node after the last one to push
*/
void
-list_unshift_range (list_t *to, list_t *from,
- list_node_t *first, list_node_t *last);
+list_push_front_range (list_t *to, list_t *from,
+ list_node_t *first, list_node_t *last);
/**
* Insert a range [first, last) to a list
diff --git a/cesar/lib/src/list.c b/cesar/lib/src/list.c
index 61771b2c53..7b01155244 100644
--- a/cesar/lib/src/list.c
+++ b/cesar/lib/src/list.c
@@ -77,7 +77,7 @@ list_empty (list_t *list)
}
void
-list_push (list_t *list, list_node_t *node)
+list_push_back (list_t *list, list_node_t *node)
{
dbg_assert (list);
dbg_assert (node && node->next == node && node->prev == node);
@@ -88,7 +88,7 @@ list_push (list_t *list, list_node_t *node)
}
void
-list_unshift (list_t *list, list_node_t *node)
+list_push_front (list_t *list, list_node_t *node)
{
dbg_assert (list);
dbg_assert (node && node->next == node && node->prev == node);
@@ -99,7 +99,7 @@ list_unshift (list_t *list, list_node_t *node)
}
list_node_t *
-list_pop (list_t *list)
+list_pop_back (list_t *list)
{
list_node_t *node;
dbg_assert (list && !list_empty (list));
@@ -112,7 +112,7 @@ list_pop (list_t *list)
}
list_node_t *
-list_shift (list_t *list)
+list_pop_front (list_t *list)
{
list_node_t *node;
dbg_assert (list && !list_empty (list));
@@ -148,16 +148,16 @@ list_insert (list_t *list, list_node_t *before, list_node_t *node)
}
void
-list_push_range (list_t *to, list_t *from,
- list_node_t *first, list_node_t *last)
+list_push_back_range (list_t *to, list_t *from,
+ list_node_t *first, list_node_t *last)
{
dbg_assert (to);
list_insert_range (to, from, &to->nil, first, last);
}
void
-list_unshift_range (list_t *to, list_t *from,
- list_node_t *first, list_node_t *last)
+list_push_front_range (list_t *to, list_t *from,
+ list_node_t *first, list_node_t *last)
{
dbg_assert (to);
list_insert_range (to, from, to->nil.next, first, last);
diff --git a/cesar/lib/src/slab.c b/cesar/lib/src/slab.c
index 058a07671a..c3aa987d61 100644
--- a/cesar/lib/src/slab.c
+++ b/cesar/lib/src/slab.c
@@ -156,7 +156,7 @@ slab_grow (slab_cache_t *cache)
}
o->next = NULL;
/* Add to partial. */
- list_push (&cache->partial, &s->node);
+ list_push_back (&cache->partial, &s->node);
/* Done. */
return s;
}
@@ -275,7 +275,7 @@ slab_free_ (void *object __FL)
((slab_object_t *) object)->next = d->free;
d->free = object;
/* Add to partial tail. */
- list_push (&cache->partial, &s->node);
+ list_push_back (&cache->partial, &s->node);
}
}
diff --git a/cesar/lib/src/trace.c b/cesar/lib/src/trace.c
index da880d7639..0bf168fa16 100644
--- a/cesar/lib/src/trace.c
+++ b/cesar/lib/src/trace.c
@@ -288,7 +288,7 @@ trace_buffer_add (trace_buffer_t *buf, const char *name, uint drop_level,
i = i->next;
} while (1);
/* Add it to context. */
- list_push (&ctx->buffers, &buf->node);
+ list_push_back (&ctx->buffers, &buf->node);
}
void
@@ -320,7 +320,7 @@ trace_buffer_add_bare (trace_buffer_t *buf, const char *name,
for (p = data; p != data + size; p++)
*p = TRACE_UNINITIALISED;
/* Add it to context. */
- list_push (&ctx->buffers, &buf->node);
+ list_push_back (&ctx->buffers, &buf->node);
}
void
diff --git a/cesar/lib/test/list/src/test_list.c b/cesar/lib/test/list/src/test_list.c
index af02728069..902d97a908 100644
--- a/cesar/lib/test/list/src/test_list.c
+++ b/cesar/lib/test/list/src/test_list.c
@@ -50,7 +50,7 @@ list_basic_test_case (test_t t)
j = lib_rnd_uniform (rnd, NB_LISTS);
items[i].list = j;
items[i].pos = lists_item_nb[j]++;
- list_push (&lists[j], &items[i].node);
+ list_push_back (&lists[j], &items[i].node);
}
/* Test loop. */
test_begin (t, "remove and insert")
@@ -151,10 +151,11 @@ list_basic_test_case (test_t t)
list_insert_range (dst_list, src_list, dst_after, first,
list_next (last));
else if (dst_begin)
- list_unshift_range (dst_list, src_list, first, list_next
- (last));
+ list_push_front_range (dst_list, src_list, first,
+ list_next (last));
else
- list_push_range (dst_list, src_list, first, list_next (last));
+ list_push_back_range (dst_list, src_list, first,
+ list_next (last));
}
else
{
@@ -164,18 +165,18 @@ list_basic_test_case (test_t t)
else
{
if (src_begin)
- n = list_shift (src_list);
+ n = list_pop_front (src_list);
else
- n = list_pop (src_list);
+ n = list_pop_back (src_list);
dbg_assert (n == first);
}
/* ...and insert. */
if (dst_center)
list_insert (dst_list, dst_after, first);
else if (dst_begin)
- list_unshift (dst_list, first);
+ list_push_front (dst_list, first);
else
- list_push (dst_list, first);
+ list_push_back (dst_list, first);
}
/* Update pos fields of moved nodes. */
for (n = first, pos = dst_pos; n != list_next (last);