Changes in src/lists.hpp [266237:46d958]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lists.hpp
r266237 r46d958 9 9 #define LISTS_HPP_ 10 10 11 class atom; 12 11 13 /******************************** Some templates for list management ***********************************/ 12 14 … … 18 20 { 19 21 X *vorher = end->previous; 20 if (vorher != NULL)22 if (vorher != 0) 21 23 vorher->next = walker; 22 24 end->previous = walker; … … 31 33 template <typename X> void unlink(X *walker) 32 34 { 33 if (walker->next != NULL)35 if (walker->next != 0) 34 36 walker->next->previous = walker->previous; 35 if (walker->previous != NULL)37 if (walker->previous != 0) 36 38 walker->previous->next = walker->next; 37 walker->next = NULL;38 walker->previous= NULL;39 walker->next = 0; 40 walker->previous= 0; 39 41 }; 40 42 … … 46 48 template <typename X> bool add(X *pointer, X *end) 47 49 { 48 if (end != NULL) {50 if (end != 0) { 49 51 link(pointer, end); 50 52 } else { 51 pointer->previous = NULL;52 pointer->next = NULL;53 pointer->previous = 0; 54 pointer->next = 0; 53 55 } 54 56 return true; … … 59 61 * \param *start begin of list 60 62 * \param *end end of list 61 * \return X - if found, NULL- if not found63 * \return X - if found, 0 - if not found 62 64 */ 63 65 template <typename X, typename Y> X * find(Y *suche, X *start, X *end) … … 68 70 if (*walker->sort == *suche) return (walker); 69 71 } 70 return NULL;72 return 0; 71 73 }; 72 74 … … 77 79 template <typename X> void removewithoutcheck(X *walker) 78 80 { 79 if (walker != NULL) {81 if (walker != 0) { 80 82 unlink(walker); 81 83 delete(walker); 82 walker = NULL;84 walker = 0; 83 85 } 84 86 }; 87 88 /** Removes an item from the list without check. 89 * specialized for atoms, because these have to be removed from the world as well 90 * the implementation for this declaration is in lists.cpp 91 * \param *walker item to be removed 92 * \return true - removing succeeded, false - given item not found in list 93 */ 94 template <> void removewithoutcheck<atom>(atom *walker); 85 95 86 96 /** Removes an item from the list, checks if exists. … … 99 109 }*/ 100 110 // atom found, now unlink 101 if (walker != NULL)111 if (walker != 0) 102 112 removewithoutcheck(walker); 103 113 else … … 114 124 { 115 125 X *pointer = start->next; 116 X *walker = NULL;126 X *walker = 0; 117 127 while (pointer != end) { // go through list 118 128 walker = pointer; // mark current … … 131 141 { 132 142 X *Binder = me; 133 while(Binder->previous != NULL)143 while(Binder->previous != 0) 134 144 Binder = Binder->previous; 135 145 return Binder; … … 143 153 { 144 154 X *Binder = me; 145 while(Binder->next != NULL)155 while(Binder->next != 0) 146 156 Binder = Binder->next; 147 157 return Binder;
Note:
See TracChangeset
for help on using the changeset viewer.