From 48e55669e34c535e1f8d907e6eb22f562d072358 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Fri, 26 Oct 2012 18:10:26 +0200 Subject: [PATCH] SLIST add function to debug length --- include/slist.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/slist.h b/include/slist.h index 0631b17..0f287c6 100644 --- a/include/slist.h +++ b/include/slist.h @@ -49,4 +49,15 @@ (*list) = head; \ } +#define SLIST_LENGTH(list,length) \ + do { \ + (length) = 0; \ + void *head = (*list); \ + while ((*list)) { \ + (*list) = (*list)->next; \ + (length)++; \ + } \ + (*list) = head; \ + } while (0); + #endif /* __iscsi_slist_h__ */