summaryrefslogtreecommitdiffabout
path: root/src/variable.c
Side-by-side diff
Diffstat (limited to 'src/variable.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/variable.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/variable.c b/src/variable.c
index 9442b6b..667cfc0 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -617,8 +617,7 @@ bref_expand(const char *str, const char *input, pcre *re,
}
VCL_VOID
-vmod_batchset(VARIABLE_CTX ctx,
- VCL_STRING vars, VCL_STRING rxs, VCL_STRING input)
+vmod_regset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING rxs, VCL_STRING input)
{
struct symtab *vt = get_symtab(ctx);
struct vardef *head = NULL, *tail = NULL, *def;
@@ -638,7 +637,7 @@ vmod_batchset(VARIABLE_CTX ctx,
pcre *re;
if (!vars || !rxs || !input) {
- log_error("variable.batchset: bad arguments: vars=%s, rxs=%s, input=%s",
+ log_error("variable.regset: bad arguments: vars=%s, rxs=%s, input=%s",
S(vars), S(rxs), S(input));
return;
}
@@ -699,7 +698,7 @@ vmod_batchset(VARIABLE_CTX ctx,
re = pcre_compile(rxs, cflags, &error_ptr, &error_offset, NULL);
if (!re) {
- log_error("variable.batchset: %s: compilation failed near %s: %s",
+ log_error("variable.regset: %s: compilation failed near %s: %s",
rxs, rxs + error_offset, error_ptr);
vardef_free(head);
return;
@@ -713,7 +712,7 @@ vmod_batchset(VARIABLE_CTX ctx,
}
if (n < count) {
- log_error("variable.batchset: %s: too few subexpressions to satisfy %s",
+ log_error("variable.regset: %s: too few subexpressions to satisfy %s",
rxs, vars);
vardef_free(head);
return;
@@ -724,13 +723,11 @@ vmod_batchset(VARIABLE_CTX ctx,
rc = pcre_exec(re, 0, input, strlen(input), 0, 0, ovector, ovsize);
if (rc <= 0) {
- if (rc == 0)
- log_error("matched, but too many substrings");
- else
- /*FIXME*/;
+ if (rc != PCRE_ERROR_NOMATCH)
+ log_error("variable.regset: pcre_exec failed: %d", rc);
vardef_free(head);
return;
- }
+ }
for (def = head; def; def = def->next, i++) {
char *s = bref_expand(def->repl, input, re, ovsize, ovector);
@@ -743,14 +740,14 @@ vmod_batchset(VARIABLE_CTX ctx,
errno = 0;
lval = strtol(s, &p, 10);
if (*p) {
- log_error("variable.batchset: %s(%s)#%d: not an integer", rxs, input, i);
+ log_error("variable.regset: %s(%s)#%d: not an integer", rxs, input, i);
value.i = 0;
} else if (errno) {
- log_error("variable.batchset: %s(%s)#%d: %s",
+ log_error("variable.regset: %s(%s)#%d: %s",
rxs, input, i, strerror(errno));
value.i = 0;
} else if (lval < INT_MIN || lval > INT_MAX) {
- log_error("variable.batchset: %s(%s)#%d: value out of range",
+ log_error("variable.regset: %s(%s)#%d: value out of range",
rxs, input, i);
value.i = 0;
} else
@@ -761,10 +758,10 @@ vmod_batchset(VARIABLE_CTX ctx,
errno = 0;
value.r = strtod(s, &p);
if (*p) {
- log_error("variable.batchset: %s(%s)#%d: not a valid number", rxs, input, i);
+ log_error("variable.regset: %s(%s)#%d: not a valid number", rxs, input, i);
value.r = 0;
} else if (errno) {
- log_error("variable.batchset: %s(%s)#%d: %s",
+ log_error("variable.regset: %s(%s)#%d: %s",
rxs, input, i, strerror(errno));
value.r = 0;
}

Return to:

Send suggestions and report system problems to the System administrator.