--- list.h 2002/10/18 10:21:41 1.2
+++ list.h 2002/10/25 13:29:02 1.3
@@ -56,31 +56,33 @@
PREV(n,l) = NULL; \
} while(0)
-#define ADDTAIL(q,l,n) \
+#define ADDTAIL2(q,l,n1,n2) \
do { \
if (TAIL(q,l)) { \
- NEXT(TAIL(q,l),l) = (n); \
- PREV(n,l) = TAIL(q,l); \
+ NEXT(TAIL(q,l),l) = (n1); \
+ PREV(n1,l) = TAIL(q,l); \
} else { \
- PREV(n,l) = NULL; \
- HEAD(q,l) = (n); \
+ HEAD(q,l) = (n1); \
+ PREV(n1,l) = NULL; \
} \
- TAIL(q,l) = (n); \
- NEXT(n,l) = NULL; \
+ TAIL(q,l) = (n2); \
+ NEXT(n2,l) = NULL; \
} while (0)
+#define ADDTAIL(q,l,n) ADDTAIL2(q,l,n,n)
-#define ADDHEAD(q,l,n) \
+#define ADDHEAD2(q,l,n1,n2) \
do { \
if (HEAD(q,l)) { \
- PREV(HEAD(q,l),l) = (n); \
- NEXT(n,l) = HEAD(q,l); \
+ PREV(HEAD(q,l),l) = (n2); \
+ NEXT(n2,l) = HEAD(q,l); \
} else { \
- NEXT(n,l) = NULL; \
- TAIL(q,l) = (n); \
+ TAIL(q,l) = (n2); \
+ NEXT(n2,l) = NULL; \
} \
- HEAD(q,l) = (n); \
- PREV(n,l) = NULL; \
+ HEAD(q,l) = (n1); \
+ PREV(n1,l) = NULL; \
} while (0)
+#define ADDHEAD(q,l,n) ADDHEAD2(q,l,n,n)
#define REMHEAD(q,l,n) \
do { \
@@ -106,31 +108,33 @@
} \
} while(0)
-#define REMOVE(q,l,n) \
+#define REMOVE2(q,l,n1,n2) \
do { \
- if (PREV(n,l)) \
- NEXT(PREV(n,l),l) = NEXT(n,l); \
+ if (PREV(n1,l)) \
+ NEXT(PREV(n1,l),l) = NEXT(n2,l); \
else \
- HEAD(q,l) = NEXT(n,l); \
- if (NEXT(n,l)) \
- PREV(NEXT(n,l),l) = PREV(n,l); \
+ HEAD(q,l) = NEXT(n2,l); \
+ if (NEXT(n2,l)) \
+ PREV(NEXT(n2,l),l) = PREV(n1,l); \
else \
- TAIL(q,l) = PREV(n,l); \
- NEXT(n,l) = NULL; \
- PREV(n,l) = NULL; \
+ TAIL(q,l) = PREV(n1,l); \
+ NEXT(n2,l) = NULL; \
+ PREV(n1,l) = NULL; \
} while (0)
+#define REMOVE(q,l,n) REMOVE2(q,l,n,n)
-#define INSERT(q,l,i,n) \
+#define INSERT2(q,l,i,n1,n2) \
do { \
if (PREV(i,l)) { \
- NEXT(PREV(i,l),l) = (n); \
+ NEXT(PREV(i,l),l) = (n1); \
} else { \
- HEAD(q,l) = (n); \
+ HEAD(q,l) = (n1); \
} \
- PREV(n,l) = PREV(i,l); \
- PREV(i,l) = (n); \
- NEXT(n,l) = (i); \
+ PREV(n1,l) = PREV(i,l); \
+ PREV(i,l) = (n2); \
+ NEXT(n2,l) = (i); \
} while (0)
+#define INSERT(q,l,i,n) INSERT2(q,l,i,n,n)
#define APPENDLIST(q1,l,q2) \
do { \
|