MINOR: pattern: Rename "pat_idx_elt" to "pattern_tree"
This is just for having coherent struct names.
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 0eb5639..31b59f4 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -1561,7 +1561,7 @@
}
else if (strcmp(args[1], "map") == 0) {
struct pattern_list *pat_elt;
- struct pat_idx_elt *idx_elt;
+ struct pattern_tree *idx_elt;
char *value = NULL;
/* Expect three parameters: map name, key and new value. */
@@ -1849,7 +1849,7 @@
else if (strcmp(args[0], "del") == 0) {
if (strcmp(args[1], "map") == 0) {
struct pattern_list *pat_elt;
- struct pat_idx_elt *idx_elt;
+ struct pattern_tree *idx_elt;
struct map_entry *ent;
/* Expect two parameters: map name and key. */
@@ -4826,7 +4826,7 @@
struct sample_storage *smp;
struct sample sample;
struct pattern *pat;
- struct pat_idx_elt *elt;
+ struct pattern_tree *elt;
enum pat_match_res res;
struct sockaddr_in addr;
char addr_str[INET_ADDRSTRLEN];
diff --git a/src/pattern.c b/src/pattern.c
index 84b54fb..fa3b7c5 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -739,13 +739,13 @@
void free_pattern_tree(struct eb_root *root)
{
struct eb_node *node, *next;
- struct pat_idx_elt *elt;
+ struct pattern_tree *elt;
node = eb_first(root);
while (node) {
next = eb_next(node);
eb_delete(node);
- elt = container_of(node, struct pat_idx_elt, node);
+ elt = container_of(node, struct pattern_tree, node);
free(elt->smp);
free(elt);
node = next;
@@ -889,7 +889,7 @@
int pat_idx_tree_ip(struct pattern_expr *expr, struct pattern *pat, char **err)
{
unsigned int mask;
- struct pat_idx_elt *node;
+ struct pattern_tree *node;
/* Only IPv4 can be indexed */
if (pat->type == SMP_T_IPV4) {
@@ -930,7 +930,7 @@
int pat_idx_tree_str(struct pattern_expr *expr, struct pattern *pat, char **err)
{
int len;
- struct pat_idx_elt *node;
+ struct pattern_tree *node;
/* Only string can be indexed */
if (pat->type != SMP_T_CSTR && pat->type != SMP_T_STR) {
@@ -1066,12 +1066,12 @@
*/
enum pat_match_res pattern_exec_match(struct pattern_expr *expr, struct sample *smp,
struct sample_storage **sample,
- struct pattern **pat, struct pat_idx_elt **idx_elt)
+ struct pattern **pat, struct pattern_tree **idx_elt)
{
enum pat_match_res pat_res = PAT_NOMATCH;
struct pattern_list *pattern;
struct ebmb_node *node = NULL;
- struct pat_idx_elt *elt;
+ struct pattern_tree *elt;
if (expr->match == pat_match_nothing) {
if (smp->data.uint)
@@ -1096,7 +1096,7 @@
}
if (node) {
pat_res |= PAT_MATCH;
- elt = ebmb_entry(node, struct pat_idx_elt, node);
+ elt = ebmb_entry(node, struct pattern_tree, node);
if (sample)
*sample = elt->smp;
if (idx_elt)
@@ -1126,12 +1126,12 @@
* NULL. Pointers are not set if they're passed as NULL.
*/
int pattern_lookup(const char *key, struct pattern_expr *expr,
- struct pattern_list **pat_elt, struct pat_idx_elt **idx_elt, char **err)
+ struct pattern_list **pat_elt, struct pattern_tree **idx_elt, char **err)
{
struct pattern pattern;
struct pattern_list *pat;
struct ebmb_node *node;
- struct pat_idx_elt *elt;
+ struct pattern_tree *elt;
unsigned int mask = 0;
/* no real pattern */
@@ -1170,7 +1170,7 @@
for (node = ebmb_first(&expr->pattern_tree);
node;
node = ebmb_next(node)) {
- elt = container_of(node, struct pat_idx_elt, node);
+ elt = container_of(node, struct pattern_tree, node);
if (strcmp(pattern.ptr.str, (char *)elt->node.key) == 0)
goto found;
}
@@ -1179,7 +1179,7 @@
for (node = ebmb_first(&expr->pattern_tree);
node;
node = ebmb_next(node)) {
- elt = container_of(node, struct pat_idx_elt, node);
+ elt = container_of(node, struct pattern_tree, node);
if (elt->node.node.pfx == mask &&
memcmp(&pattern.val.ipv4.addr.s_addr, elt->node.key, 4) == 0)
goto found;