Commit 0692a290 authored by Nils Goroll's avatar Nils Goroll
parent 56c6ebb9
......@@ -48,7 +48,7 @@ static vre_t *chars = NULL, *dots = NULL, *stars = NULL, *meta = NULL;
* else if A is shorter than B
* else if strcmp(A, B) < 0.
*
* VRB_FIND and VRB_INSERT are only called during vcl_init, so the
* VRBT_FIND and VRBT_INSERT are only called during vcl_init, so the
* comparator is not on the critical performance path.
*/
int
......@@ -108,7 +108,7 @@ path_cmp(const struct assignment * restrict const ass_a,
return cmp;
}
VRB_GENERATE(assign_tree, assignment, entry, path_cmp)
VRBT_GENERATE(assign_tree, assignment, entry, path_cmp)
void
validation_init(void)
......
......@@ -284,7 +284,7 @@ vmod_hosts__fini(struct vmod_hoailona_hosts **hostsp)
free(host->name);
if (host->description != NULL)
free(host->description);
a = VRB_MIN(assign_tree, &host->assignments);
a = VRBT_MIN(assign_tree, &host->assignments);
while (a != NULL) {
struct assignment *next_ass;
......@@ -299,7 +299,7 @@ vmod_hosts__fini(struct vmod_hoailona_hosts **hostsp)
if (a->pattern->re != NULL)
VRT_re_fini(a->pattern->re);
}
next_ass = VRB_NEXT(assign_tree, a, a);
next_ass = VRBT_NEXT(assign_tree, a, a);
FREE_OBJ(a);
a = next_ass;
}
......@@ -418,19 +418,19 @@ vmod_hosts_add(VRT_CTX, struct vmod_hoailona_hosts *hosts,
hosts->vcl_name);
return;
}
else if (path == NULL && !VRB_EMPTY(&host->assignments)) {
else if (path == NULL && !VRBT_EMPTY(&host->assignments)) {
VERR(ctx, "Path-specific policies already set for "
"host %s in %s.add()", hostname, hosts->vcl_name);
AZ(re);
return;
}
else if (path != NULL && !VRB_EMPTY(&host->assignments)) {
else if (path != NULL && !VRBT_EMPTY(&host->assignments)) {
struct pattern tmp_pattern;
struct assignment tmp_assign, *result;
tmp_pattern.path = (void *)path;
tmp_assign.pattern = &tmp_pattern;
if ((result = VRB_FIND(assign_tree, &host->assignments,
if ((result = VRBT_FIND(assign_tree, &host->assignments,
&tmp_assign))
!= NULL) {
VERR(ctx, "Policy %s already assigned for host "
......@@ -448,7 +448,7 @@ vmod_hosts_add(VRT_CTX, struct vmod_hoailona_hosts *hosts,
AN(host);
host->name = strdup(hostname);
host->len = strlen(hostname);
VRB_INIT(&host->assignments);
VRBT_INIT(&host->assignments);
AZ(host->description);
AZ(host->policy);
VSTAILQ_INSERT_TAIL(&hosts->hosthead, host, list);
......@@ -473,7 +473,7 @@ vmod_hosts_add(VRT_CTX, struct vmod_hoailona_hosts *hosts,
assign->pattern = pattern;
if (description != NULL)
assign->description = strdup(description);
AZ(VRB_INSERT(assign_tree, &host->assignments, assign));
AZ(VRBT_INSERT(assign_tree, &host->assignments, assign));
}
VCL_INT
......@@ -567,8 +567,8 @@ vmod_hosts_policy(VRT_CTX, struct vmod_hoailona_hosts *hosts,
return -1;
/* There is a policy XOR there is a list of assignments */
assert((host->policy != NULL && VRB_EMPTY(&host->assignments))
|| (host->policy == NULL && !VRB_EMPTY(&host->assignments)));
assert((host->policy != NULL && VRBT_EMPTY(&host->assignments))
|| (host->policy == NULL && !VRBT_EMPTY(&host->assignments)));
if (host->policy != NULL) {
task->host = host;
task->policy = host->policy;
......@@ -579,9 +579,9 @@ vmod_hosts_policy(VRT_CTX, struct vmod_hoailona_hosts *hosts,
struct assignment *a, *assignment = NULL;
int pathlen = strlen(pathname);
/* XXX lazily compute and save VRB_MIN for the host
/* XXX lazily compute and save VRBT_MIN for the host
assignments, and re-use it to init the for loop */
VRB_FOREACH(a, assign_tree, &host->assignments) {
VRBT_FOREACH(a, assign_tree, &host->assignments) {
int match;
CHECK_OBJ(a, VMOD_HOAILONA_ASSIGNMENT_MAGIC);
......
......@@ -58,18 +58,18 @@ struct vmod_hoailona_policy {
struct assignment {
unsigned magic;
#define VMOD_HOAILONA_ASSIGNMENT_MAGIC 0x7523d6e8
VRB_ENTRY(assignment) entry;
VRBT_ENTRY(assignment) entry;
struct pattern *pattern;
struct vmod_hoailona_policy *policy;
char *description;
};
VRB_HEAD(assign_tree, assignment);
VRBT_HEAD(assign_tree, assignment);
int path_cmp(const struct assignment * restrict const ass_a,
const struct assignment * restrict const ass_b);
VRB_PROTOTYPE(assign_tree, assignment, entry, path_cmp)
VRBT_PROTOTYPE(assign_tree, assignment, entry, path_cmp)
void validation_init(void);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment