aboutsummaryrefslogtreecommitdiff
path: root/src/linked-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/linked-list.c')
-rw-r--r--src/linked-list.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/linked-list.c b/src/linked-list.c
index 095b63e..3c57bf0 100644
--- a/src/linked-list.c
+++ b/src/linked-list.c
@@ -14,13 +14,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <cflow.h>
static struct linked_list *
-deref_linked_list (struct linked_list **plist)
+deref_linked_list(struct linked_list **plist)
{
if (!*plist) {
struct linked_list *list = xmalloc(sizeof(*list));
list->free_data = NULL;
list->head = list->tail = NULL;
*plist = list;
@@ -141,6 +141,19 @@ data_in_list(void *data, struct linked_list *list)
for (p = linked_list_head(list); p; p = p->next)
if (p->data == data)
return 1;
return 0;
}
+
+size_t
+linked_list_size(struct linked_list *list)
+{
+ size_t size = 0;
+ if (list) {
+ struct linked_list_entry *p;
+ for (p = linked_list_head(list); p; p = p->next)
+ size++;
+ }
+ return size;
+}
+

Return to:

Send suggestions and report system problems to the System administrator.