[master] c580ff5 Make this less magical and more readable.
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jul 9 13:56:22 CEST 2014
commit c580ff5ebb8233125257cd138ddb7d5dcaf8d7a8
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jul 9 11:47:14 2014 +0000
Make this less magical and more readable.
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index f189785..526e91d 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -446,6 +446,10 @@ VGZ_Destroy(struct vgz **vgp)
/*--------------------------------------------------------------------*/
+#define VFP_GUNZIP 0
+#define VFP_GZIP 1
+#define VFP_TESTGUNZIP 2
+
static enum vfp_status __match_proto__(vfp_init_f)
vfp_gzip_init(struct busyobj *bo, struct vfp_entry *vfe)
{
@@ -454,7 +458,7 @@ vfp_gzip_init(struct busyobj *bo, struct vfp_entry *vfe)
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC);
- if (vfe->vfp->priv2)
+ if (vfe->vfp->priv2 == VFP_GZIP)
vg = VGZ_NewGzip(bo->vsl, vfe->vfp->priv1);
else
vg = VGZ_NewUngzip(bo->vsl, vfe->vfp->priv1);
@@ -647,6 +651,7 @@ const struct vfp vfp_gunzip = {
.pull = vfp_gunzip_pull,
.fini = vfp_gzip_fini,
.priv1 = "U F -",
+ .priv2 = VFP_GUNZIP,
};
const struct vfp vfp_gzip = {
@@ -655,7 +660,7 @@ const struct vfp vfp_gzip = {
.pull = vfp_gzip_pull,
.fini = vfp_gzip_fini,
.priv1 = "G F -",
- .priv2 = 1,
+ .priv2 = VFP_GZIP,
};
const struct vfp vfp_testgunzip = {
@@ -664,4 +669,5 @@ const struct vfp vfp_testgunzip = {
.pull = vfp_testgunzip_pull,
.fini = vfp_gzip_fini,
.priv1 = "u F -",
+ .priv2 = VFP_TESTGUNZIP,
};
More information about the varnish-commit
mailing list