Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef __JAR_DS_h_ |
michael@0 | 6 | #define __JAR_DS_h_ |
michael@0 | 7 | |
michael@0 | 8 | /* Typedefs */ |
michael@0 | 9 | typedef struct ZZLinkStr ZZLink; |
michael@0 | 10 | typedef struct ZZListStr ZZList; |
michael@0 | 11 | |
michael@0 | 12 | /* |
michael@0 | 13 | ** Circular linked list. Each link contains a pointer to the object that |
michael@0 | 14 | ** is actually in the list. |
michael@0 | 15 | */ |
michael@0 | 16 | struct ZZLinkStr { |
michael@0 | 17 | ZZLink *next; |
michael@0 | 18 | ZZLink *prev; |
michael@0 | 19 | JAR_Item *thing; |
michael@0 | 20 | }; |
michael@0 | 21 | |
michael@0 | 22 | struct ZZListStr { |
michael@0 | 23 | ZZLink link; |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | #define ZZ_InitList(lst) \ |
michael@0 | 27 | { \ |
michael@0 | 28 | (lst)->link.next = &(lst)->link; \ |
michael@0 | 29 | (lst)->link.prev = &(lst)->link; \ |
michael@0 | 30 | (lst)->link.thing = 0; \ |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | #define ZZ_ListEmpty(lst) ((lst)->link.next == &(lst)->link) |
michael@0 | 34 | |
michael@0 | 35 | #define ZZ_ListHead(lst) ((lst)->link.next) |
michael@0 | 36 | |
michael@0 | 37 | #define ZZ_ListTail(lst) ((lst)->link.prev) |
michael@0 | 38 | |
michael@0 | 39 | #define ZZ_ListIterDone(lst,lnk) ((lnk) == &(lst)->link) |
michael@0 | 40 | |
michael@0 | 41 | #define ZZ_AppendLink(lst,lnk) \ |
michael@0 | 42 | { \ |
michael@0 | 43 | (lnk)->next = &(lst)->link; \ |
michael@0 | 44 | (lnk)->prev = (lst)->link.prev; \ |
michael@0 | 45 | (lst)->link.prev->next = (lnk); \ |
michael@0 | 46 | (lst)->link.prev = (lnk); \ |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | #define ZZ_InsertLink(lst,lnk) \ |
michael@0 | 50 | { \ |
michael@0 | 51 | (lnk)->next = (lst)->link.next; \ |
michael@0 | 52 | (lnk)->prev = &(lst)->link; \ |
michael@0 | 53 | (lst)->link.next->prev = (lnk); \ |
michael@0 | 54 | (lst)->link.next = (lnk); \ |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | #define ZZ_RemoveLink(lnk) \ |
michael@0 | 58 | { \ |
michael@0 | 59 | (lnk)->next->prev = (lnk)->prev; \ |
michael@0 | 60 | (lnk)->prev->next = (lnk)->next; \ |
michael@0 | 61 | (lnk)->next = 0; \ |
michael@0 | 62 | (lnk)->prev = 0; \ |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | extern ZZLink * |
michael@0 | 66 | ZZ_NewLink(JAR_Item *thing); |
michael@0 | 67 | |
michael@0 | 68 | extern void |
michael@0 | 69 | ZZ_DestroyLink(ZZLink *link); |
michael@0 | 70 | |
michael@0 | 71 | extern ZZList * |
michael@0 | 72 | ZZ_NewList(void); |
michael@0 | 73 | |
michael@0 | 74 | extern void |
michael@0 | 75 | ZZ_DestroyList(ZZList *list); |
michael@0 | 76 | |
michael@0 | 77 | |
michael@0 | 78 | #endif /* __JAR_DS_h_ */ |