return back;
}
-/* Returns the front element in 'list'.
- Undefined behavior if 'list' is empty. */
+/* Returns the front element in 'list_'.
+ Undefined behavior if 'list_' is empty. */
struct list *
-list_front(struct list *list)
+list_front(const struct list *list_)
{
+ struct list *list = (struct list *) list_;
+
assert(!list_is_empty(list));
return list->next;
}
-/* Returns the back element in 'list'.
- Undefined behavior if 'list' is empty. */
+/* Returns the back element in 'list_'.
+ Undefined behavior if 'list_' is empty. */
struct list *
-list_back(struct list *list)
+list_back(const struct list *list_)
{
+ struct list *list = (struct list *) list_;
+
assert(!list_is_empty(list));
return list->prev;
}
/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct list *list_pop_back(struct list *);
/* List elements. */
-struct list *list_front(struct list *);
-struct list *list_back(struct list *);
+struct list *list_front(const struct list *);
+struct list *list_back(const struct list *);
/* List properties. */
size_t list_size(const struct list *);