Lines Matching defs:key

55 #define key dict_key
147 * dict_next() successor function, verifying that the key of each node is
161 if (dict->compare(first->key, next->key) > 0)
167 if (dict->compare(first->key, next->key) >= 0)
433 * Locate a node in the dictionary having the given key.
438 dnode_t *dict_lookup(dict_t *dict, const void *key)
448 result = dict->compare(key, root->key);
460 while (root != nil && dict->compare(key, root->key))
473 * Look for the node corresponding to the lowest key that is equal to or
474 * greater than the given key. If there is no such node, return null.
476 dnode_t *dict_lower_bound(dict_t *dict, const void *key)
483 int result = dict->compare(key, root->key);
504 * Look for the node corresponding to the greatest key that is equal to or
505 * lower than the given key. If there is no such node, return null.
507 dnode_t *dict_upper_bound(dict_t *dict, const void *key)
514 int result = dict->compare(key, root->key);
542 void dict_insert(dict_t *dict, dnode_t *node, const void *key)
548 node->key = key;
558 result = dict->compare(key, where->key);
559 /* trap attempts at duplicate key insertion unless it's explicitly allowed */
651 * we avoid the traditional algorithm under which the successor's key and
813 int dict_alloc_insert(dict_t *dict, const void *key, void *data)
819 dict_insert(dict, node, key);
834 * Return the node with the lowest (leftmost) key. If the dictionary is empty
849 * Return the node with the highest (rightmost) key. If the dictionary is empty
865 * next key in the the left to right ordering. If the node has
891 * Return the given node's predecessor, in the key order.
991 return dnode->key;
1036 void dict_load_next(dict_load_t *load, dnode_t *newnode, const void *key)
1047 dict_assert(dict->compare(nil->left->key, key) <= 0);
1049 dict_assert(dict->compare(nil->left->key, key) < 0);
1053 newnode->key = key;
1156 if (dest->compare(leftnode->key, rightnode->key) < 0)
1175 dict_load_next(&load, leftnode, leftnode->key);
1186 dict_load_next(&load, rightnode, rightnode->key);
1271 const char *key;
1275 "a <key> <val> add new entry\n";
1305 key = dupstring(tok1);
1309 if (!key || !val || !dn) {
1311 free((void *) key);
1317 dict_load_next(&dl, dn, key);
1337 const char *key;
1340 "a <key> <val> add value to dictionary\n"
1341 "d <key> delete value from dictionary\n"
1342 "l <key> lookup value in dictionary\n"
1343 "( <key> lookup lower bound\n"
1344 ") <key> lookup upper bound\n"
1376 key = dupstring(tok1);
1379 if (!key || !val) {
1381 free((void *) key);
1385 if (!dict_alloc_insert(d, key, val)) {
1387 free((void *) key);
1403 key = dnode_getkey(dn);
1407 free((void *) key);