Commit 19e75b64 authored by Geoff Simmons's avatar Geoff Simmons

Simplify evaluation of the select ENUM.

parent a43e7ab7
......@@ -429,16 +429,20 @@ select(VRT_CTX, const struct match_data * const restrict match,
const char * const restrict obj, VCL_ENUM const restrict selects,
const char * const restrict method)
{
if (selects == vmod_enum_UNIQUE) {
if (match->n != 1) {
VERR(ctx, "%s.%s(select=UNIQUE): "
"%d elements were matched", obj, method, match->n);
return (UINT_MAX);
}
if (selects == vmod_enum_EXACT) {
if (match->exact == UINT_MAX)
VERR(ctx, "%s.%s(select=EXACT): "
"no element matched exactly", obj, method);
return match->exact;
}
if (match->n == 1)
return match->indices[0];
if (selects == vmod_enum_UNIQUE) {
VERR(ctx, "%s.%s(select=UNIQUE): %d elements were matched",
obj, method, match->n);
return (UINT_MAX);
}
if (selects == vmod_enum_EXACT)
return match->exact;
if (selects == vmod_enum_FIRST)
return match->min;
if (selects == vmod_enum_LAST)
......
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