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__ */