diff options
Diffstat (limited to 'src/variable.c')
-rw-r--r-- | src/variable.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/variable.c b/src/variable.c index bd79c3b..e6bad1a 100644 --- a/src/variable.c +++ b/src/variable.c | |||
@@ -383,12 +383,14 @@ vmod_global_unset(VARIABLE_CTX ctx, VCL_STRING name) | |||
383 | 383 | ||
384 | static struct symtab * | 384 | static struct symtab * |
385 | get_symtab(VARIABLE_CTX ctx) | 385 | get_symtab(VARIABLE_CTX ctx) |
386 | { | 386 | { |
387 | struct symtab *st; | 387 | struct symtab *st; |
388 | int fd = ctx->req->sp->fd; | 388 | int fd = ctx->req->sp->fd; |
389 | |||
390 | assert(fd >= 0); | ||
389 | AZ(pthread_mutex_lock(&symtab_mtx)); | 391 | AZ(pthread_mutex_lock(&symtab_mtx)); |
390 | if (symtabc <= fd) { | 392 | if (symtabc <= fd) { |
391 | size_t n = fd + 1; | 393 | size_t n = fd + 1; |
392 | symtabv = realloc(symtabv, n * sizeof(symtabv[0])); | 394 | symtabv = realloc(symtabv, n * sizeof(symtabv[0])); |
393 | while (symtabc < n) | 395 | while (symtabc < n) |
394 | symtabv[symtabc++] = NULL; | 396 | symtabv[symtabc++] = NULL; |
@@ -725,13 +727,12 @@ vmod_regset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING rxs, | |||
725 | size_t n; | 727 | size_t n; |
726 | const char *v = vars; | 728 | const char *v = vars; |
727 | const char *error_ptr; | 729 | const char *error_ptr; |
728 | int error_offset; | 730 | int error_offset; |
729 | int cflags = 0; | 731 | int cflags = 0; |
730 | union value value; | 732 | union value value; |
731 | char *p; | ||
732 | int ovsize; | 733 | int ovsize; |
733 | int *ovector; | 734 | int *ovector; |
734 | int i; | 735 | int i; |
735 | int rc; | 736 | int rc; |
736 | pcre *re; | 737 | pcre *re; |
737 | 738 | ||
@@ -859,13 +860,13 @@ xdecode(char *s) | |||
859 | d = strchr(s, '%'); | 860 | d = strchr(s, '%'); |
860 | if (!d) | 861 | if (!d) |
861 | return; | 862 | return; |
862 | 863 | ||
863 | for (s = d; *s; ) { | 864 | for (s = d; *s; ) { |
864 | if (*s == '%' && hex2ul(s[1]) != -1 && hex2ul(s[2]) != -1) { | 865 | if (*s == '%' && hex2ul(s[1]) != -1 && hex2ul(s[2]) != -1) { |
865 | *d++ = hex2ul(s[1]) << 4 + hex2ul(s[2]); | 866 | *d++ = (hex2ul(s[1]) << 4) + hex2ul(s[2]); |
866 | s += 3; | 867 | s += 3; |
867 | } else | 868 | } else |
868 | *d++ = *s++; | 869 | *d++ = *s++; |
869 | } | 870 | } |
870 | 871 | ||
871 | *d = 0; | 872 | *d = 0; |
@@ -895,13 +896,12 @@ define_param(struct symtab *vt, struct vardef *def, | |||
895 | VCL_VOID | 896 | VCL_VOID |
896 | vmod_queryset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING query) | 897 | vmod_queryset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING query) |
897 | { | 898 | { |
898 | struct symtab *vt = get_symtab(ctx); | 899 | struct symtab *vt = get_symtab(ctx); |
899 | struct vardef *head = NULL, *tail = NULL, *def; | 900 | struct vardef *head = NULL, *tail = NULL, *def; |
900 | size_t count = 0; | 901 | size_t count = 0; |
901 | size_t n; | ||
902 | const char *v = vars; | 902 | const char *v = vars; |
903 | 903 | ||
904 | while (*v) { | 904 | while (*v) { |
905 | char const *nameptr = v; | 905 | char const *nameptr = v; |
906 | size_t n = strcspn(v, ":,"); | 906 | size_t n = strcspn(v, ":,"); |
907 | size_t namelen = n; | 907 | size_t namelen = n; |
@@ -960,11 +960,11 @@ vmod_queryset(VARIABLE_CTX ctx, VCL_STRING vars, VCL_STRING query) | |||
960 | if (def) | 960 | if (def) |
961 | define_param(vt, def, valptr, vallen); | 961 | define_param(vt, def, valptr, vallen); |
962 | } else { | 962 | } else { |
963 | def = vardef_new(variable_string, paramptr, paramlen, | 963 | def = vardef_new(variable_string, paramptr, paramlen, |
964 | NULL, 0); | 964 | NULL, 0); |
965 | define_param(vt, def, valptr, vallen); | 965 | define_param(vt, def, valptr, vallen); |
966 | free(def); | 966 | vardef_free(def); |
967 | } | 967 | } |
968 | } | 968 | } |
969 | vardef_free(head); | 969 | vardef_free(head); |
970 | } | 970 | } |