From c65d2299bdee98122a59afd9f93024575890a8d4 Mon Sep 17 00:00:00 2001 From: Vojtech Vilimek Date: Tue, 11 Jul 2023 14:32:27 +0200 Subject: [PATCH] code cleanup --- filter/trie.c | 62 ---------------------------------------------- filter/trie_test.c | 9 ------- 2 files changed, 71 deletions(-) diff --git a/filter/trie.c b/filter/trie.c index 3668dda1..d097ceb8 100644 --- a/filter/trie.c +++ b/filter/trie.c @@ -1004,68 +1004,6 @@ trie_walk_init(struct f_trie_walk_state *s, const struct f_trie *t, const net_ad } return 0; - -// if (child) -// -// { -// /* Performs basically more granular net_comapre_ip{4,6}() */ -// if (v4) net4 = (struct net_addr_ip4 *) net; -// else net6 = (struct net_addr_ip6 *) net; -// -// int cmp = v4 ? ip4_compare(child->v4.addr, net4->prefix) -// : ip6_compare(child->v6.addr, net6->prefix); -// if (cmp < 0) -// { -// while () -// { -// } -// /* We continue as we've just finished walk in a child node */ -// s->local_pos = before_pos(bits + 1, TRIE_STEP); -// s->stack_pos++; -// s->stack[s->stack_pos] = child; -// s->local_pos = last_pos(TRIE_STEP); -// } -// else if (cmp > 0) -// { -// /* We continue in child node */ -// if (bits % 2 == 0) -// { -// s->stack_pos++; -// s->stack[s->stack_pos] = child; -// s->local_pos = 1; //last_pos(TRIE_STEP); -// } -// //s->local_pos = 0x08 + (bits >> 1); -// //s->local_pos = before_pos(bits, TRIE_STEP); -// //s->local_pos = MAX(0, after_pos(bits - 1, TRIE_STEP)); //s->local_pos = before_pos(bits >> 1, TRIE_STEP); -// else -// //s->local_pos = MIN((1u << TRIE_STEP) + bits, (1u << TRIE_STEP) + 15); -// s->local_pos = after_pos(bits, TRIE_STEP); -// } -// else -// { -// if (v4 ? child->v4.plen <= net4->pxlen : child->v6.plen < net6->pxlen) -// { -// /* We continue in child node */ -// if (bits % 2 == 0) -// s->local_pos = before_pos(bits >> 1, TRIE_STEP); -// //s->local_pos = 0x08 + (bits >> 1); -// else -// //s->local_pos = MIN((1u << TRIE_STEP) + bits, (1u << TRIE_STEP) + 15); -// s->local_pos = after_pos(bits, TRIE_STEP); -// } -// else -// { -// /* We continue in current node from first position */ -// s->stack_pos++; -// s->stack[s->stack_pos] = child; -// s->local_pos = 1; -// } -// } -// return 0; -// } -// -// s->local_pos = 0x10 + bits; -// return 0; } #define GET_ACCEPT_BIT(N,X,B) ((X) ? ip4_getbit((N)->v4.accept, (B)) : ip6_getbit((N)->v6.accept, (B))) diff --git a/filter/trie_test.c b/filter/trie_test.c index 895c9e20..ffc5e63a 100644 --- a/filter/trie_test.c +++ b/filter/trie_test.c @@ -259,11 +259,6 @@ make_random_prefix_list(int num, int v6, int tight) struct f_prefix_node *px = lp_allocz(tmp_linpool, sizeof(struct f_prefix_node)); get_random_prefix(&px->prefix, v6, tight); add_tail(prefixes, &px->n); - - //char buf[64]; - //bt_format_net(buf, 64, &px->prefix.net); - //bt_debug("ADD %s{%d,%d}\n", buf, px->prefix.lo, px->prefix.hi); - //log("ADD %s{%d,%d}", buf, px->prefix.lo, px->prefix.hi); } return prefixes; @@ -314,10 +309,6 @@ read_prefix_list(FILE *f, int v6, int plus) px->prefix.lo = pl; px->prefix.hi = plus ? IP4_MAX_PREFIX_LENGTH : pl; add_tail(pxlist, &px->n); - - //char buf[64]; - //bt_format_net(buf, 64, &px->prefix.net); - //bt_debug("ADD %s{%d,%d}\n", buf, px->prefix.lo, px->prefix.hi); } bt_syscall(errno, "fgets()");