Commit c0a1057d by Geoff Simmons

Use a macro for the long list of regex options.

parent 87df40f0
......@@ -30,6 +30,13 @@
#include "config.h"
#define REGEX_OPTS \
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 never_capture, \
VCL_BOOL case_sensitive, VCL_BOOL perl_classes, \
VCL_BOOL word_boundary, VCL_BOOL one_line
typedef struct task_match_t {
unsigned magic;
#define TASK_MATCH_MAGIC 0xa4b93c57
......@@ -232,12 +239,7 @@ event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
VCL_VOID
vmod_regex__init(const struct vrt_ctx *ctx, struct vmod_re2_regex **rep,
const char *vcl_name, VCL_STRING pattern, 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 never_capture, VCL_BOOL case_sensitive,
VCL_BOOL perl_classes, VCL_BOOL word_boundary,
VCL_BOOL one_line)
const char *vcl_name, VCL_STRING pattern, REGEX_OPTS)
{
struct vmod_re2_regex *re;
const char *err;
......@@ -472,11 +474,7 @@ vmod_regex_extract(VRT_CTX, struct vmod_re2_regex *re, VCL_STRING text,
VCL_BOOL
vmod_match(VRT_CTX, struct vmod_priv *priv, VCL_STRING pattern,
VCL_STRING subject, 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 never_capture,
VCL_BOOL case_sensitive, VCL_BOOL perl_classes,
VCL_BOOL word_boundary, VCL_BOOL one_line)
VCL_STRING subject, REGEX_OPTS)
{
vre2 *vre2 = NULL;
task_match_t *task_match;
......@@ -623,12 +621,7 @@ vmod_namedref(VRT_CTX, struct vmod_priv *priv, VCL_STRING name,
static VCL_STRING
rewrite_function(VRT_CTX, const rewrite_e mode, VCL_STRING restrict pattern,
VCL_STRING restrict text, VCL_STRING restrict rewrite,
VCL_STRING restrict fallback, 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 never_capture, VCL_BOOL case_sensitive,
VCL_BOOL perl_classes, VCL_BOOL word_boundary,
VCL_BOOL one_line)
VCL_STRING restrict fallback, REGEX_OPTS)
{
vre2 *vre2 = NULL;
const char *ret, *err;
......@@ -687,11 +680,7 @@ rewrite_function(VRT_CTX, const rewrite_e mode, VCL_STRING restrict pattern,
VCL_STRING
vmod_sub(VRT_CTX, VCL_STRING pattern, VCL_STRING text, VCL_STRING rewrite,
VCL_STRING fallback, 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 never_capture,
VCL_BOOL case_sensitive, VCL_BOOL perl_classes, VCL_BOOL word_boundary,
VCL_BOOL one_line)
VCL_STRING fallback, REGEX_OPTS)
{
return rewrite_function(ctx, SUB, pattern, text, rewrite, fallback,
utf8, posix_syntax, longest_match, max_mem,
......@@ -702,11 +691,7 @@ vmod_sub(VRT_CTX, VCL_STRING pattern, VCL_STRING text, VCL_STRING rewrite,
VCL_STRING
vmod_suball(VRT_CTX, VCL_STRING pattern, VCL_STRING text, VCL_STRING rewrite,
VCL_STRING fallback, 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 never_capture,
VCL_BOOL case_sensitive, VCL_BOOL perl_classes,
VCL_BOOL word_boundary, VCL_BOOL one_line)
VCL_STRING fallback, REGEX_OPTS)
{
return rewrite_function(ctx, SUBALL, pattern, text, rewrite, fallback,
utf8, posix_syntax, longest_match, max_mem,
......@@ -717,11 +702,7 @@ vmod_suball(VRT_CTX, VCL_STRING pattern, VCL_STRING text, VCL_STRING rewrite,
VCL_STRING
vmod_extract(VRT_CTX, VCL_STRING pattern, VCL_STRING text, VCL_STRING rewrite,
VCL_STRING fallback, 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 never_capture,
VCL_BOOL case_sensitive, VCL_BOOL perl_classes,
VCL_BOOL word_boundary, VCL_BOOL one_line)
VCL_STRING fallback, REGEX_OPTS)
{
return rewrite_function(ctx, EXTRACT, pattern, text, rewrite, fallback,
utf8, posix_syntax, longest_match, max_mem,
......
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