__decl_thread(HA_SPINLOCK_T lock); /* Lock used to protect pat ref elements */
};
-/* This is a part of struct pat_ref. Each entry contain one
- * pattern and one associated value as original string.
+/* This is a part of struct pat_ref. Each entry contains one pattern and one
+ * associated value as original string. All derivative forms (via exprs) are
+ * accessed from list_head or tree_head.
*/
struct pat_ref_elt {
struct list list; /* Used to chain elements. */
struct list back_refs; /* list of users tracking this pat ref */
+ struct list list_head; /* all pattern_list derived from this reference */
+ struct list tree_head; /* all pattern_tree derived from this reference */
char *pattern;
char *sample;
int line;
* "sample" with a tree entry. It is used with maps.
*/
struct pattern_tree {
+ struct list from_ref; // pattern_tree linked from pat_ref_elt
struct sample_data *data;
struct pat_ref_elt *ref;
struct ebmb_node node;
/* This struct is just used for chaining patterns */
struct pattern_list {
+ struct list from_ref; // pattern_tree linked from pat_ref_elt
struct list list;
struct pattern pat;
};
next = eb_next(node);
eb_delete(node);
elt = container_of(node, struct pattern_tree, node);
+ LIST_DEL(&elt->from_ref);
free(elt->data);
free(elt);
node = next;
list_for_each_entry_safe(pat, tmp, &expr->patterns, list) {
LIST_DEL(&pat->list);
+ LIST_DEL(&pat->from_ref);
if (pat->pat.sflags & PAT_SF_REGFREE)
regex_free(pat->pat.ptr.ptr);
else
/* chain pattern in the expression */
LIST_ADDQ(&expr->patterns, &patl->list);
+ /* and from the reference */
+ LIST_ADDQ(&pat->ref->list_head, &patl->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* chain pattern in the expression */
LIST_ADDQ(&expr->patterns, &patl->list);
+ /* and from the reference */
+ LIST_ADDQ(&pat->ref->list_head, &patl->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* chain pattern in the expression */
LIST_ADDQ(&expr->patterns, &patl->list);
+ /* and from the reference */
+ LIST_ADDQ(&pat->ref->list_head, &patl->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* chain pattern in the expression */
LIST_ADDQ(&expr->patterns, &patl->list);
+ /* and from the reference */
+ LIST_ADDQ(&pat->ref->list_head, &patl->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* Insert the entry. */
ebmb_insert_prefix(&expr->pattern_tree, &node->node, 4);
+ LIST_ADDQ(&pat->ref->tree_head, &node->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* Insert the entry. */
ebmb_insert_prefix(&expr->pattern_tree_2, &node->node, 16);
+ LIST_ADDQ(&pat->ref->tree_head, &node->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* index the new node */
ebst_insert(&expr->pattern_tree, &node->node);
+ LIST_ADDQ(&pat->ref->tree_head, &node->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* index the new node */
ebmb_insert_prefix(&expr->pattern_tree, &node->node, len);
+ LIST_ADDQ(&pat->ref->tree_head, &node->from_ref);
expr->ref->revision = rdtsc();
/* that's ok */
/* Delete and free entry. */
LIST_DEL(&pat->list);
+ LIST_DEL(&pat->from_ref);
if (pat->pat.sflags & PAT_SF_REGFREE)
regex_free(pat->pat.ptr.reg);
else
/* Delete and free entry. */
ebmb_delete(node);
+ LIST_DEL(&elt->from_ref);
free(elt->data);
free(elt);
}
/* Delete and free entry. */
ebmb_delete(node);
+ LIST_DEL(&elt->from_ref);
free(elt->data);
free(elt);
}
/* Delete and free entry. */
ebmb_delete(node);
+ LIST_DEL(&elt->from_ref);
free(elt->data);
free(elt);
}
}
LIST_INIT(&elt->back_refs);
+ LIST_INIT(&elt->list_head);
+ LIST_INIT(&elt->tree_head);
LIST_ADDQ(&ref->head, &elt->list);
return elt;
fail:
bref->ref = NULL;
}
LIST_DEL(&elt->list);
+ LIST_DEL(&elt->list_head);
+ LIST_DEL(&elt->tree_head);
free(elt->pattern);
free(elt->sample);
free(elt);