diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-03-23 17:46:47 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-03-23 17:46:47 +0200 |
commit | 87ff2f5ebb147d6800b838d8e9dd6063305ddd47 (patch) | |
tree | efd4a7b00276286221a71229a4f42226a71c83bd | |
parent | 347da6028be9ae8ea1b5ac0a82ad7783780e6782 (diff) | |
download | vmod-dict-87ff2f5ebb147d6800b838d8e9dd6063305ddd47.tar.gz vmod-dict-87ff2f5ebb147d6800b838d8e9dd6063305ddd47.tar.bz2 |
Restore backward compatibility with <6.2
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/vmod_dict.c | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 1dc3887..c37cc81 100644 --- a/configure.ac +++ b/configure.ac @@ -36,25 +36,25 @@ if test "x$ac_cv_prog_cc_c99" = xno; then fi AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_MAKE_SET # Checks for header files. AC_HEADER_STDC # Check for functions -AM_VARNISHAPI([4.1],[6.3.1]) +AM_VARNISHAPI([4.1],[6.3.2]) AC_DEFINE_UNQUOTED([VARNISHAPI_MAJOR],[$VARNISHAPI_MAJOR], [Varnish API major version number]) AC_CONFIG_TESTDIR(tests) AC_CONFIG_FILES([tests/Makefile tests/atlocal]) AM_MISSING_PROG([AUTOM4TE], [autom4te]) AC_CONFIG_FILES([ Makefile src/Makefile ]) AC_OUTPUT diff --git a/src/vmod_dict.c b/src/vmod_dict.c index 81f35e2..8c1e230 100644 --- a/src/vmod_dict.c +++ b/src/vmod_dict.c @@ -23,24 +23,32 @@ #include <ctype.h> #include <syslog.h> #if VARNISHAPI_MAJOR > 5 # include <cache/cache.h> # include <vcl.h> # include <vcc_if.h> #else # include <vcl.h> # include <vrt.h> # include <vcc_if.h> # include <cache/cache.h> #endif + +#ifdef VPFX +# define VEVENT(a) VPFX(a) +#else +/* For compatibility with varnish prior to 6.2 */ +# define VEVENT(a) a +#endif + #include <vas.h> struct entry { char *key; char *val; size_t hash; struct entry *next, *prev; }; static struct entry *ent_head, *ent_tail; static size_t ent_count; @@ -365,25 +373,25 @@ fill_table(void) if (n > cn) cn = n; hash_table[i] = ent; } if (max_coll <= 0 || cn < max_coll) break; next_size = next_size * 2 + 1; } while (next_size < max_hash_size); } int -vmod_dict_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) +VEVENT(dict_event)(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) { switch (e) { case VCL_EVENT_LOAD: pthread_rwlock_init(&rwlock, NULL); break; case VCL_EVENT_DISCARD: pthread_rwlock_wrlock(&rwlock); while (ent_head) entry_remove(ent_head); free(hash_table); hash_table = NULL; |