aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1parser
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-08-25 00:42:44 +0000
committerLev Walkin <vlm@lionet.info>2004-08-25 00:42:44 +0000
commitc7d17be4587edfb4fb3d7d1f0b50f286aac311f9 (patch)
tree3dbdc22623996da21a9d0652bb903ff89737317c /libasn1parser
parent1ef0516f46b763faf1ed5a61b96fdf0c2d37a0b1 (diff)
proper way of doing list move
Diffstat (limited to 'libasn1parser')
-rw-r--r--libasn1parser/asn1p_list.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/libasn1parser/asn1p_list.h b/libasn1parser/asn1p_list.h
index 1f808780..4a71fdd9 100644
--- a/libasn1parser/asn1p_list.h
+++ b/libasn1parser/asn1p_list.h
@@ -4,19 +4,25 @@
#ifndef ASN1_PARSER_LIST_H
#define ASN1_PARSER_LIST_H
-#define TQ_HEAD(type) \
- struct { \
- type *tq_head; \
- type**tq_tail; \
+#define TQ_HEAD(type) \
+ struct { \
+ type *tq_head; \
+ type**tq_tail; \
}
-#define TQ_HEAD_COPY(to, from) \
- do { (to)->tq_head = (from)->tq_head; \
- (to)->tq_tail = (from)->tq_tail; } while(0)
+#define TQ_MOVE(to, from) do { \
+ if(&(TQ_FIRST(from)) == (from)->tq_tail) { \
+ 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) \
- struct { \
- type *tq_next; \
+#define TQ_ENTRY(type) \
+ struct { \
+ type *tq_next; \
}
#define TQ_FIRST(headp) ((headp)->tq_head)