Lines Matching refs:rootp
44 node_t **rootp = (node_t **)vrootp;
46 if (rootp == NULL)
49 while (*rootp != NULL) { /* Knuth's T1: */
52 if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
53 return *rootp; /* we found it! */
55 rootp = (r < 0) ?
56 &(*rootp)->llink : /* T3: follow left branch */
57 &(*rootp)->rlink; /* T4: follow right branch */
62 *rootp = q; /* link new node to old */
119 node_t **rootp = (node_t **)vrootp;
123 if (rootp == NULL || (p = *rootp) == NULL)
126 while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) {
127 p = *rootp;
128 rootp = (cmp < 0) ?
129 &(*rootp)->llink : /* follow llink branch */
130 &(*rootp)->rlink; /* follow rlink branch */
131 if (*rootp == NULL)
134 r = (*rootp)->rlink; /* D1: */
135 if ((q = (*rootp)->llink) == NULL) /* Left NULL? */
145 q->llink = (*rootp)->llink;
146 q->rlink = (*rootp)->rlink;
149 free(*rootp); /* D4: Free node */
150 *rootp = q; /* link parent to new node */
165 node_t **rootp = (node_t **)vrootp;
167 if (rootp == NULL)
170 while (*rootp != NULL) { /* T1: */
173 if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
174 return *rootp; /* key found */
175 rootp = (r < 0) ?
176 &(*rootp)->llink : /* T3: follow left branch */
177 &(*rootp)->rlink; /* T4: follow right branch */