Commit c7d17be4 authored by Lev Walkin's avatar Lev Walkin

proper way of doing list move

parent 1ef0516f
...@@ -4,19 +4,25 @@ ...@@ -4,19 +4,25 @@
#ifndef ASN1_PARSER_LIST_H #ifndef ASN1_PARSER_LIST_H
#define ASN1_PARSER_LIST_H #define ASN1_PARSER_LIST_H
#define TQ_HEAD(type) \ #define TQ_HEAD(type) \
struct { \ struct { \
type *tq_head; \ type *tq_head; \
type**tq_tail; \ type**tq_tail; \
} }
#define TQ_HEAD_COPY(to, from) \ #define TQ_MOVE(to, from) do { \
do { (to)->tq_head = (from)->tq_head; \ if(&(TQ_FIRST(from)) == (from)->tq_tail) { \
(to)->tq_tail = (from)->tq_tail; } while(0) TQ_INIT(to); \
} else { \
(to)->tq_head = (from)->tq_head; \
(to)->tq_tail = (from)->tq_tail; \
} \
TQ_INIT(from); \
} while(0)
#define TQ_ENTRY(type) \ #define TQ_ENTRY(type) \
struct { \ struct { \
type *tq_next; \ type *tq_next; \
} }
#define TQ_FIRST(headp) ((headp)->tq_head) #define TQ_FIRST(headp) ((headp)->tq_head)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment