aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2015-02-13 13:39:16 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2015-02-13 13:49:47 +0200
commitff77b396197ae9d4891831efda4d3a0c7f71b6e4 (patch)
treeea16465b368ccc37ac5f3c0160b9852813665e70
parente6754a1b721358b5588f67bdb7eef6ab662c0ee2 (diff)
downloadvmod-variable-ff77b396197ae9d4891831efda4d3a0c7f71b6e4.tar.gz
vmod-variable-ff77b396197ae9d4891831efda4d3a0c7f71b6e4.tar.bz2
Bugfixes
* src/variable.c (vmod_defined): Fix return type. (vmod_regset): Fix ovsize calculation. * src/variable.vcc (defined): Fix return type.
-rw-r--r--src/variable.c15
-rw-r--r--src/variable.vcc2
2 files changed, 9 insertions, 8 deletions
diff --git a/src/variable.c b/src/variable.c
index 5deda1b..4dbfba5 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -383,7 +383,7 @@ get_symtab(VARIABLE_CTX ctx)
#define getvar(vt, name) symtab_lookup_or_install(vt, name, NULL)
-struct variable *
+static struct variable *
defvar(struct symtab *vt, const char *name, enum variable_type t,
union value *val)
{
@@ -466,7 +466,7 @@ DEF(int, VCL_INT, i)
DEF(real, VCL_REAL, r)
DEF(duration, VCL_DURATION, d)
-VCL_INT
+VCL_BOOL
vmod_defined(VARIABLE_CTX ctx, VCL_STRING name)
{
return !!getvar(get_symtab(ctx), name);
@@ -485,7 +485,7 @@ vmod_undef(VARIABLE_CTX ctx, VCL_STRING name)
symtab_remove(get_symtab(ctx), name);
}
-void
+static void
log_error(const char *fmt, ...)
{
va_list ap;
@@ -601,7 +601,7 @@ str2duration(const char *str)
return *p ? 0 : r;
}
-char *
+static char *
bref_expand(const char *str, const char *input, pcre *re,
int ovsize, int *ovector)
{
@@ -783,12 +783,13 @@ vmod_regset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING rxs,
rxs, vars);
vardef_free(head);
return;
- }
-
- ovsize = (count + 1) * 3;
+ }
+
+ ovsize = (n + 1) * 3;
ovector = calloc(ovsize, sizeof(*ovector));
rc = pcre_exec(re, 0, input, strlen(input), 0, 0, ovector, ovsize);
+
if (rc <= 0) {
if (rc != PCRE_ERROR_NOMATCH)
log_error("variable.regset: pcre_exec failed: %d", rc);
diff --git a/src/variable.vcc b/src/variable.vcc
index f0106e9..9bf8f46 100644
--- a/src/variable.vcc
+++ b/src/variable.vcc
@@ -30,7 +30,7 @@ $Function VOID set_duration(STRING, DURATION)
$Function DURATION get_duration(STRING)
$Function VOID clear()
-$Function INT defined(STRING)
+$Function BOOL defined(STRING)
$Function STRING type_of(STRING)
$Function VOID undef(STRING)
$Function VOID regset(STRING, STRING, STRING)

Return to:

Send suggestions and report system problems to the System administrator.