refactor enum handling

parent f343aa75
......@@ -109,34 +109,33 @@ decimal_digits(int n)
VCL_VOID
vmod_set__init(VRT_CTX, struct vmod_re2_set **setp, const char *vcl_name,
VCL_ENUM anchor, VCL_BOOL utf8, VCL_BOOL posix_syntax,
VCL_ENUM anchor_a, VCL_BOOL utf8, VCL_BOOL posix_syntax,
VCL_BOOL longest_match, VCL_INT max_mem, VCL_BOOL literal,
VCL_BOOL never_nl, VCL_BOOL dot_nl, VCL_BOOL case_sensitive,
VCL_BOOL perl_classes, VCL_BOOL word_boundary, VCL_BOOL one_line)
{
struct vmod_re2_set *set;
anchor_e anchor_e;
anchor_e anchor;
const char *err;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(setp);
AZ(*setp);
AN(vcl_name);
AN(anchor);
ALLOC_OBJ(set, VMOD_RE2_SET_MAGIC);
AN(set);
*setp = set;
if (strcmp(anchor, "none") == 0)
anchor_e = NONE;
else if (strcmp(anchor, "start") == 0)
anchor_e = START;
else if (strcmp(anchor, "both") == 0)
anchor_e = BOTH;
if (anchor_a == VENUM(none))
anchor = NONE;
else if (anchor_a == VENUM(start))
anchor = START;
else if (anchor_a == VENUM(both))
anchor = BOTH;
else
WRONG("illegal anchor");
if ((err = vre2set_init(&set->set, anchor_e, utf8, posix_syntax,
if ((err = vre2set_init(&set->set, anchor, utf8, posix_syntax,
longest_match, max_mem, literal, never_nl,
dot_nl, case_sensitive, perl_classes,
word_boundary, one_line))
......
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