Changeset 7 in kStuff for trunk/include/k/kAvlTmpl/kAvlDoWithAll.h
- Timestamp:
- Feb 4, 2008 2:08:02 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/include/k/kAvlTmpl/kAvlDoWithAll.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/k/kAvlTmpl/kAvlDoWithAll.h
r2 r7 43 43 KAVLNODE *aEntries[KAVL_MAX_STACK]; 44 44 char achFlags[KAVL_MAX_STACK]; 45 KAVLROOT pRoot; 45 46 } KAVL_INT(STACK2); 46 47 … … 50 51 * 51 52 * @returns 0 on success. Return from callback on failure. 52 * @param p pTree Pointer to the AVL-tree root node pointer.53 * @param pRoot Pointer to the AVL-tree root structure. 53 54 * @param fFromLeft K_TRUE: Left to right. 54 55 * K_FALSE: Right to left. … … 56 57 * @param pvUser User parameter passed on to the callback function. 57 58 */ 58 KAVL_DECL(int) KAVL_FN(DoWithAll)(KAVL TREEPTR *ppTree, KBOOL fFromLeft, KAVL_TYPE(PFN,CALLBACK) pfnCallBack, void *pvUser)59 KAVL_DECL(int) KAVL_FN(DoWithAll)(KAVLROOT *pRoot, KBOOL fFromLeft, KAVL_TYPE(PFN,CALLBACK) pfnCallBack, void *pvUser) 59 60 { 60 61 KAVL_INT(STACK2) AVLStack; … … 65 66 int rc; 66 67 67 if (*ppTree == KAVL_NULL) 68 KAVL_READ_LOCK(pRoot); 69 if (pRoot->mpRoot == KAVL_NULL) 70 { 71 KAVL_READ_UNLOCK(pRoot); 68 72 return 0; 73 } 69 74 70 75 AVLStack.cEntries = 1; 71 76 AVLStack.achFlags[0] = 0; 72 AVLStack.aEntries[0] = KAVL_GET_POINTER( ppTree);77 AVLStack.aEntries[0] = KAVL_GET_POINTER(&pRoot->mpRoot); 73 78 74 79 if (fFromLeft) … … 99 104 rc = pfnCallBack(pEqual, pvUser); 100 105 if (rc) 106 { 107 KAVL_READ_UNLOCK(pRoot); 101 108 return rc; 109 } 102 110 } 103 111 #endif … … 139 147 rc = pfnCallBack(pEqual, pvUser); 140 148 if (rc) 149 { 150 KAVL_READ_UNLOCK(pRoot); 141 151 return rc; 152 } 142 153 } 143 154 #endif … … 153 164 } 154 165 166 KAVL_READ_UNLOCK(pRoot); 155 167 return 0; 156 168 }
Note:
See TracChangeset
for help on using the changeset viewer.

