Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef UTLIST_H
00025 #define UTLIST_H
00026
00027 #define UTLIST_VERSION 1.9.1
00028
00029
00030
00031
00032 #define DL_PREPEND(head,add) \
00033 do { \
00034 (add)->next = head; \
00035 if (head) { \
00036 (add)->prev = (head)->prev; \
00037 (head)->prev = (add); \
00038 } else { \
00039 (add)->prev = (add); \
00040 } \
00041 (head) = (add); \
00042 } while (0)
00043
00044 #define DL_APPEND(head,add) \
00045 do { \
00046 if (head) { \
00047 (add)->prev = (head)->prev; \
00048 (head)->prev->next = (add); \
00049 (head)->prev = (add); \
00050 (add)->next = NULL; \
00051 } else { \
00052 (head)=(add); \
00053 (head)->prev = (head); \
00054 (head)->next = NULL; \
00055 } \
00056 } while (0);
00057
00058 #define DL_DELETE(head,del) \
00059 do { \
00060 if ((del)->prev == (del)) { \
00061 (head)=NULL; \
00062 } else if ((del)==(head)) { \
00063 (del)->next->prev = (del)->prev; \
00064 (head) = (del)->next; \
00065 } else { \
00066 (del)->prev->next = (del)->next; \
00067 if ((del)->next) { \
00068 (del)->next->prev = (del)->prev; \
00069 } else { \
00070 (head)->prev = (del)->prev; \
00071 } \
00072 } \
00073 } while (0);
00074
00075
00076 #define DL_FOREACH(head,el) \
00077 for(el=head;el;el=el->next)
00078
00079
00080 #define DL_FOREACH_SAFE(head,el,tmp) \
00081 for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
00082
00083
00084 #define DL_SEARCH_SCALAR LL_SEARCH_SCALAR
00085 #define DL_SEARCH LL_SEARCH
00086
00087 #endif
00088