Showing
1 changed file
with
2 additions
and
3 deletions
| @@ -116,12 +116,11 @@ typedef enum {rbBlack=1, rbRed=2} TR_rbColor; | @@ -116,12 +116,11 @@ typedef enum {rbBlack=1, rbRed=2} TR_rbColor; | ||
| 116 | while(1) { \ | 116 | while(1) { \ |
| 117 | (found) = (comp)((node)->data, (search)); \ | 117 | (found) = (comp)((node)->data, (search)); \ |
| 118 | if (0 != (found)) { \ | 118 | if (0 != (found)) { \ |
| 119 | - if (! ((node)->left || (node)->right)) { \ | ||
| 120 | - break; \ | ||
| 121 | - } \ | ||
| 122 | if (0 < (found)) { \ | 119 | if (0 < (found)) { \ |
| 120 | + if (! (node)->left) break; \ | ||
| 123 | (node) = (node)->left; \ | 121 | (node) = (node)->left; \ |
| 124 | } else { \ | 122 | } else { \ |
| 123 | + if (! (node)->right) break; \ | ||
| 125 | (node) = (node)->right; \ | 124 | (node) = (node)->right; \ |
| 126 | } \ | 125 | } \ |
| 127 | } else { \ | 126 | } else { \ |
Please
register
or
login
to post a comment