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