Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f74b186 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Andre Eisenbach
Browse files

Add list_back_node method to osi list

Change-Id: I919ce97373701cbdea03b8228b3a90263d7ef180
parent 8ccdbbde
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -48,6 +48,10 @@ void *list_front(const list_t *list);
// be NULL or empty.
void *list_back(const list_t *list);

// Returns the last node in the list without removing it. |list| may not
// be NULL or empty.
list_node_t *list_back_node(const list_t *list);

// Inserts |data| after |prev_node| in |list|. |data|, |list|, and |prev_node|
// may not be NULL. This function does not make a copy of |data| so the pointer
// must remain valid at least until the element is removed from the list or the
+7 −0
Original line number Diff line number Diff line
@@ -79,6 +79,13 @@ void *list_back(const list_t *list) {
  return list->tail->data;
}

list_node_t *list_back_node(const list_t *list) {
  assert(list != NULL);
  assert(!list_is_empty(list));

  return list->tail;
}

bool list_insert_after(list_t *list, list_node_t *prev_node, void *data) {
  assert(list != NULL);
  assert(prev_node != NULL);