[master] 189a598eb Move directors.hash::backend to STRANDS
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Jul 3 16:50:09 UTC 2019
commit 189a598ebf1e78436a95678d7255c4d399458b26
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Wed Jul 3 18:45:02 2019 +0200
Move directors.hash::backend to STRANDS
diff --git a/lib/libvmod_directors/hash.c b/lib/libvmod_directors/hash.c
index a82e19fe3..897c5a567 100644
--- a/lib/libvmod_directors/hash.c
+++ b/lib/libvmod_directors/hash.c
@@ -108,29 +108,25 @@ vmod_hash_remove_backend(VRT_CTX,
}
VCL_BACKEND v_matchproto_()
-vmod_hash_backend(VRT_CTX, struct vmod_directors_hash *rr,
- const char *arg, ...)
+vmod_hash_backend(VRT_CTX, struct vmod_directors_hash *rr, VCL_STRANDS s)
{
struct VSHA256Context sha_ctx;
- va_list ap;
const char *p;
unsigned char sha256[VSHA256_LEN];
VCL_BACKEND be;
double r;
+ int i;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_ORNULL(ctx->bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(rr, VMOD_DIRECTORS_HASH_MAGIC);
VSHA256_Init(&sha_ctx);
- va_start(ap, arg);
- p = arg;
- while (p != vrt_magic_string_end) {
+ for (i = 0; i < s->n; i++) {
+ p = s->p[i];
if (p != NULL && *p != '\0')
VSHA256_Update(&sha_ctx, p, strlen(p));
- p = va_arg(ap, const char *);
}
- va_end(ap);
VSHA256_Final(sha256, &sha_ctx);
r = vbe32dec(sha256);
diff --git a/lib/libvmod_directors/vmod.vcc b/lib/libvmod_directors/vmod.vcc
index 5bb6837f9..bafab18d6 100644
--- a/lib/libvmod_directors/vmod.vcc
+++ b/lib/libvmod_directors/vmod.vcc
@@ -217,7 +217,7 @@ Remove a backend from the director.
Example::
vdir.remove_backend(backend1);
-$Method BACKEND .backend(STRING_LIST)
+$Method BACKEND .backend(STRANDS)
Pick a backend from the backend director.
More information about the varnish-commit
mailing list