summaryrefslogtreecommitdiff
path: root/lib/classifier.c
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2014-06-13 14:52:59 -0700
committerJarno Rajahalme <jrajahalme@nicira.com>2014-06-13 14:52:59 -0700
commit197573ac0229b694461d0d98e7e5172c068ab20c (patch)
treeba3e5085f2decc7721d23ecf4029e763d3334b72 /lib/classifier.c
parent31125ebd8f9b946dc69baadb0f4b2043760e5f6e (diff)
downloadopenvswitch-197573ac0229b694461d0d98e7e5172c068ab20c.tar.gz
lib/classifier: Clarify trie_lookup_value().
trie_lookup_value() is easier to read with the local variable 'plen' renamed as 'ofs'. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/classifier.c')
-rw-r--r--lib/classifier.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/classifier.c b/lib/classifier.c
index 7bad3ac34..c12758f51 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -2137,26 +2137,26 @@ static unsigned int
trie_lookup_value(const struct trie_node *node, const ovs_be32 value[],
unsigned int *checkbits)
{
- unsigned int plen = 0, match_len = 0;
+ unsigned int ofs = 0, match_len = 0;
const struct trie_node *prev = NULL;
- for (; node; prev = node, node = trie_next_node(node, value, plen)) {
+ for (; node; prev = node, node = trie_next_node(node, value, ofs)) {
unsigned int eqbits;
/* Check if this edge can be followed. */
- eqbits = prefix_equal_bits(node->prefix, node->nbits, value, plen);
- plen += eqbits;
+ eqbits = prefix_equal_bits(node->prefix, node->nbits, value, ofs);
+ ofs += eqbits;
if (eqbits < node->nbits) { /* Mismatch, nothing more to be found. */
- /* Bit at offset 'plen' differed. */
- *checkbits = plen + 1; /* Includes the first mismatching bit. */
+ /* Bit at offset 'ofs' differed. */
+ *checkbits = ofs + 1; /* Includes the first mismatching bit. */
return match_len;
}
/* Full match, check if rules exist at this prefix length. */
if (node->n_rules > 0) {
- match_len = plen;
+ match_len = ofs;
}
}
/* Dead end, exclude the other branch if it exists. */
- *checkbits = !prev || trie_is_leaf(prev) ? plen : plen + 1;
+ *checkbits = !prev || trie_is_leaf(prev) ? ofs : ofs + 1;
return match_len;
}