#define TRIE_HEADER uint8_t type; uint8_t bits; int number
#define TRIE_TYPE_CHECK(_x, _r) do { if ((trie->type == FR_TRIE_INVALID) || \
(trie->type >= FR_TRIE_MAX) || \
- !trie_ ## _x [trie->type]) { \
+ !trie_ ## _x ##_table [trie->type]) { \
fr_strerror_printf("unknown trie type %d", trie->type); \
return _r; \
} } while (0)
}
#endif
-static trie_key_match_t trie_match[FR_TRIE_MAX] = {
+static trie_key_match_t trie_match_table[FR_TRIE_MAX] = {
[ FR_TRIE_USER ] = trie_user_match,
[ FR_TRIE_NODE ] = trie_node_match,
#ifdef WITH_PATH_COMPRESSION
/*
* Recursively match each type.
*/
- return trie_match[trie->type](trie, key, start_bit, end_bit, exact);
+ return trie_match_table[trie->type](trie, key, start_bit, end_bit, exact);
}
/** Lookup a key in a trie and return user ctx, if any
}
#endif
-static trie_key_insert_t trie_insert[FR_TRIE_MAX] = {
+static trie_key_insert_t trie_insert_table[FR_TRIE_MAX] = {
[ FR_TRIE_USER ] = trie_user_insert,
[ FR_TRIE_NODE ] = trie_node_insert,
#ifdef WITH_PATH_COMPRESSION
TRIE_TYPE_CHECK(insert, -1);
#ifndef TESTING
- return trie_insert[trie->type](ctx, trie_p, key, start_bit, end_bit, data);
+ return trie_insert_table[trie->type](ctx, trie_p, key, start_bit, end_bit, data);
#else
MPRINT3("%.*srecurse at start %d end %d with data %s\n", start_bit, spaces, start_bit, end_bit, (char *) data);
- if (trie_insert[trie->type](ctx, trie_p, key, start_bit, end_bit, data) < 0) {
+ if (trie_insert_table[trie->type](ctx, trie_p, key, start_bit, end_bit, data) < 0) {
return -1;
}
}
#endif
-static trie_key_remove_t trie_remove[FR_TRIE_MAX] = {
+static trie_key_remove_t trie_remove_table[FR_TRIE_MAX] = {
[ FR_TRIE_USER ] = trie_user_remove,
[ FR_TRIE_NODE ] = trie_node_remove,
#ifdef WITH_PATH_COMPRESSION
TRIE_TYPE_CHECK(remove, NULL);
- return trie_remove[trie->type](ctx, trie_p, key, start_bit, end_bit);
+ return trie_remove_table[trie->type](ctx, trie_p, key, start_bit, end_bit);
}
/** Remove a key and return the associated user ctx
}
#endif
-static fr_trie_key_walk_t trie_walk[FR_TRIE_MAX] = {
+static fr_trie_key_walk_t trie_walk_table[FR_TRIE_MAX] = {
[ FR_TRIE_USER ] = trie_user_walk,
[ FR_TRIE_NODE ] = trie_node_walk,
#ifdef WITH_PATH_COMPRESSION
*/
if ((cb->start + BYTEOF(depth + trie->bits + 8)) >= cb->end) return 0;
- return trie_walk[trie->type](trie, cb, depth, more);
+ return trie_walk_table[trie->type](trie, cb, depth, more);
}
#ifdef WITH_TRIE_VERIFY
#endif
-static fr_trie_dump_t trie_dump[FR_TRIE_MAX] = {
+static fr_trie_dump_t trie_dump_table[FR_TRIE_MAX] = {
[ FR_TRIE_USER ] = trie_user_dump,
[ FR_TRIE_NODE ] = trie_node_dump,
#ifdef WITH_PATH_COMPRESSION
TRIE_TYPE_CHECK(dump, -1);
- trie_dump[trie->type](fp, trie, (char const *) cb->start, keylen);
+ trie_dump_table[trie->type](fp, trie, (char const *) cb->start, keylen);
return 0;
}