From ab25550f8e70ec48bae4018854129cbfcaa0273a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 17 Nov 2002 01:35:01 +0000 Subject: [PATCH] Added a initque() inline function. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1972 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/kqueue.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/headers/private/kernel/kqueue.h b/headers/private/kernel/kqueue.h index 738f7e234c..2edfda5396 100644 --- a/headers/private/kernel/kqueue.h +++ b/headers/private/kernel/kqueue.h @@ -5,6 +5,9 @@ #ifndef KQUEUE_H #define KQUEUE_H +/* The name "que" actually means that it is a very + * light-weight implementation of a queue ;-)) + */ /* The object that is put into a queue must begin with these * fields, but it doesn't have to be this structure. @@ -15,13 +18,24 @@ struct quehead { }; -/** Inserts an element (a) to the queue (b) */ +/** Initializes a queue to be used */ static inline void -insque(void *a, void *b) +initque(void *_head) { - struct quehead *element = (struct quehead *)a, - *head = (struct quehead *)b; + struct quehead *head = (struct quehead *)_head; + + head->next = head->prev = head; +} + + +/** Inserts an element (_element) to the queue (_head) */ + +static inline void +insque(void *_element, void *_head) +{ + struct quehead *element = (struct quehead *)_element, + *head = (struct quehead *)_head; element->next = head->next; element->prev = head; @@ -33,9 +47,9 @@ insque(void *a, void *b) /** removes an element from the queue it's currently in */ static inline void -remque(void *a) +remque(void *_element) { - struct quehead *element = (struct quehead *)a; + struct quehead *element = (struct quehead *)_element; element->next->prev = element->prev; element->prev->next = element->next;