[master] 81d406e1d Consistent naming of struct vdp_ctx * arguments
Nils Goroll
nils.goroll at uplex.de
Mon Dec 11 11:28:06 UTC 2023
commit 81d406e1d8f03479408228accd5fa77748e7c1c1
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Dec 11 12:15:12 2023 +0100
Consistent naming of struct vdp_ctx * arguments
for improved greppability, cosistently name struct vdp_ctx * variables
vdc.
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 7fb7b87be..936191ea3 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -309,7 +309,7 @@ ved_vdp_esi_fini(struct vdp_ctx *vdc, void **priv)
}
static int v_matchproto_(vdp_bytes_f)
-ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+ved_vdp_esi_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
const uint8_t *q, *r;
@@ -324,14 +324,14 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
act = VDP_FLUSH;
AN(priv);
- CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC);
pp = ptr;
while (1) {
switch (ecx->state) {
case 0:
- ecx->p = ObjGetAttr(vdx->wrk, ecx->preq->objcore,
+ ecx->p = ObjGetAttr(vdc->wrk, ecx->preq->objcore,
OA_ESIDATA, &l);
AN(ecx->p);
assert(l > 0);
@@ -339,7 +339,7 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
if (*ecx->p == VEC_GZ) {
if (ecx->pecx == NULL)
- retval = VDP_bytes(vdx, VDP_NULL,
+ retval = VDP_bytes(vdc, VDP_NULL,
gzip_hdr, 10);
ecx->l_crc = 0;
ecx->crc = crc32(0L, Z_NULL, 0);
@@ -357,14 +357,14 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
case VEC_V1:
case VEC_V2:
case VEC_V8:
- ecx->l = ved_decode_len(vdx->vsl, &ecx->p);
+ ecx->l = ved_decode_len(vdc->vsl, &ecx->p);
if (ecx->l < 0)
return (-1);
if (ecx->isgzip) {
assert(*ecx->p == VEC_C1 ||
*ecx->p == VEC_C2 ||
*ecx->p == VEC_C8);
- l = ved_decode_len(vdx->vsl, &ecx->p);
+ l = ved_decode_len(vdc->vsl, &ecx->p);
if (l < 0)
return (-1);
icrc = vbe32dec(ecx->p);
@@ -378,7 +378,7 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
case VEC_S1:
case VEC_S2:
case VEC_S8:
- ecx->l = ved_decode_len(vdx->vsl, &ecx->p);
+ ecx->l = ved_decode_len(vdc->vsl, &ecx->p);
if (ecx->l < 0)
return (-1);
Debug("SKIP1(%d)\n", (int)ecx->l);
@@ -395,7 +395,7 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
q++;
r = (void*)strchr((const char*)q, '\0');
AN(r);
- if (VDP_bytes(vdx, VDP_FLUSH, NULL, 0)) {
+ if (VDP_bytes(vdc, VDP_FLUSH, NULL, 0)) {
ecx->p = ecx->e;
break;
}
@@ -406,7 +406,7 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
ecx->p = r + 1;
break;
default:
- VSLb(vdx->vsl, SLT_Error,
+ VSLb(vdc->vsl, SLT_Error,
"ESI corruption line %d 0x%02x [%s]\n",
__LINE__, *ecx->p, ecx->p);
WRONG("ESI-codes: Illegal code");
@@ -439,7 +439,7 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
ecx->crc, ecx->l_crc);
ecx->pecx->l_crc += ecx->l_crc;
}
- retval = VDP_bytes(vdx, VDP_END, ptr, len);
+ retval = VDP_bytes(vdc, VDP_END, ptr, len);
ecx->state = 99;
return (retval);
case 3:
@@ -451,7 +451,7 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
*/
if (ecx->l <= len) {
if (ecx->state == 3)
- retval = VDP_bytes(vdx, act,
+ retval = VDP_bytes(vdc, act,
pp, ecx->l);
len -= ecx->l;
pp += ecx->l;
@@ -459,7 +459,7 @@ ved_vdp_esi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
break;
}
if (ecx->state == 3 && len > 0)
- retval = VDP_bytes(vdx, act, pp, len);
+ retval = VDP_bytes(vdc, act, pp, len);
ecx->l -= len;
return (retval);
case 99:
@@ -524,7 +524,7 @@ ved_pretend_gzip_fini(struct vdp_ctx *vdc, void **priv)
}
static int v_matchproto_(vdp_bytes_f)
-ved_pretend_gzip_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+ved_pretend_gzip_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *pv, ssize_t l)
{
uint8_t buf1[5], buf2[5];
@@ -532,7 +532,7 @@ ved_pretend_gzip_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
uint16_t lx;
struct ecx *ecx;
- CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC);
(void)priv;
@@ -652,7 +652,7 @@ ved_gzgz_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
*/
static int v_matchproto_(vdp_bytes_f)
-ved_gzgz_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+ved_gzgz_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
struct ved_foo *foo;
@@ -660,7 +660,7 @@ ved_gzgz_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
ssize_t dl;
ssize_t l;
- (void)vdx;
+ (void)vdc;
CAST_OBJ_NOTNULL(foo, *priv, VED_FOO_MAGIC);
pp = ptr;
if (len > 0) {
@@ -834,12 +834,12 @@ ved_vdp_fini(struct vdp_ctx *vdc, void **priv)
}
static int v_matchproto_(vdp_bytes_f)
-ved_vdp_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+ved_vdp_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
struct ecx *ecx;
- (void)vdx;
+ (void)vdc;
CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC);
return (ved_bytes(ecx, act, ptr, len));
}
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index c1434dc62..d49b03c41 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -288,7 +288,7 @@ VGZ_Gzip(struct vgz *vg, const void **pptr, ssize_t *plen, enum vgz_flag flags)
*/
static int v_matchproto_(vdp_init_f)
-vdp_gunzip_init(VRT_CTX, struct vdp_ctx *vdp, void **priv, struct objcore *oc)
+vdp_gunzip_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
{
struct vgz *vg;
struct boc *boc;
@@ -299,9 +299,9 @@ vdp_gunzip_init(VRT_CTX, struct vdp_ctx *vdp, void **priv, struct objcore *oc)
uint64_t u;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- CHECK_OBJ_NOTNULL(vdp, VDP_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
CHECK_OBJ_ORNULL(oc, OBJCORE_MAGIC);
- req = vdp->req;
+ req = vdc->req;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
vg = VGZ_NewGunzip(req->vsl, "U D -");
@@ -353,7 +353,7 @@ vdp_gunzip_fini(struct vdp_ctx *vdc, void **priv)
}
static int v_matchproto_(vdp_bytes_f)
-vdp_gunzip_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+vdp_gunzip_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
enum vgzret_e vr;
@@ -362,8 +362,8 @@ vdp_gunzip_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
struct worker *wrk;
struct vgz *vg;
- CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
- wrk = vdx->wrk;
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
+ wrk = vdc->wrk;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
(void)act;
@@ -385,9 +385,9 @@ vdp_gunzip_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
if (vr < VGZ_OK)
return (-1);
if (vg->m_len == vg->m_sz || vr != VGZ_OK) {
- if (VDP_bytes(vdx, vr == VGZ_END ? VDP_END : VDP_FLUSH,
+ if (VDP_bytes(vdc, vr == VGZ_END ? VDP_END : VDP_FLUSH,
vg->m_buf, vg->m_len))
- return (vdx->retval);
+ return (vdc->retval);
vg->m_len = 0;
VGZ_Obuf(vg, vg->m_buf, vg->m_sz);
}
diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c
index bde81ccc7..d7398f33f 100644
--- a/bin/varnishd/cache/cache_range.c
+++ b/bin/varnishd/cache/cache_range.c
@@ -65,7 +65,7 @@ vrg_range_fini(struct vdp_ctx *vdc, void **priv)
}
static int v_matchproto_(vdp_bytes_f)
-vrg_range_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+vrg_range_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
int retval = 0;
@@ -73,7 +73,7 @@ vrg_range_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
const char *p = ptr;
struct vrg_priv *vrg_priv;
- CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
AN(priv);
CAST_OBJ_NOTNULL(vrg_priv, *priv, VRG_PRIV_MAGIC);
@@ -93,9 +93,9 @@ vrg_range_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
}
if (l > 0)
- retval = VDP_bytes(vdx, act, p, l);
+ retval = VDP_bytes(vdc, act, p, l);
else if (l == 0 && act > VDP_NULL)
- retval = VDP_bytes(vdx, act, p, 0);
+ retval = VDP_bytes(vdc, act, p, 0);
return (retval || act == VDP_END ? 1 : 0);
}
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index e9ffad17c..404ebc894 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -189,7 +189,7 @@ void VDI_Event(const struct director *d, enum vcl_event_e ev);
void VDI_Init(void);
/* cache_deliver_proc.c */
-void VDP_Init(struct vdp_ctx *vdx, struct worker *wrk, struct vsl_log *vsl,
+void VDP_Init(struct vdp_ctx *vdc, struct worker *wrk, struct vsl_log *vsl,
struct req *req);
uint64_t VDP_Close(struct vdp_ctx *, struct objcore *, struct boc *);
void VDP_Panic(struct vsb *vsb, const struct vdp_ctx *vdc);
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 86a2dfd0e..6bed2b08d 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -40,19 +40,19 @@
/*--------------------------------------------------------------------*/
static int v_matchproto_(vdp_bytes_f)
-v1d_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+v1d_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
ssize_t wl = 0;
- CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
(void)priv;
- AZ(vdx->nxt); /* always at the bottom of the pile */
+ AZ(vdc->nxt); /* always at the bottom of the pile */
if (len > 0)
- wl = V1L_Write(vdx->wrk, ptr, len);
- if (act > VDP_NULL && V1L_Flush(vdx->wrk) != SC_NULL)
+ wl = V1L_Write(vdc->wrk, ptr, len);
+ if (act > VDP_NULL && V1L_Flush(vdc->wrk) != SC_NULL)
return (-1);
if (len != wl)
return (-1);
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 632d999ef..267ea91ea 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -111,12 +111,12 @@ h2_fini(struct vdp_ctx *vdc, void **priv)
}
static int v_matchproto_(vdp_bytes_f)
-h2_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+h2_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
struct h2_req *r2;
- CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
CAST_OBJ_NOTNULL(r2, *priv, H2_REQ_MAGIC);
(void)act;
@@ -124,9 +124,9 @@ h2_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
return (-1);
if (len == 0)
return (0);
- H2_Send_Get(vdx->wrk, r2->h2sess, r2);
- vdx->bytes_done = 0;
- H2_Send(vdx->wrk, r2, H2_F_DATA, H2FF_NONE, len, ptr, &vdx->bytes_done);
+ H2_Send_Get(vdc->wrk, r2->h2sess, r2);
+ vdc->bytes_done = 0;
+ H2_Send(vdc->wrk, r2, H2_F_DATA, H2FF_NONE, len, ptr, &vdc->bytes_done);
H2_Send_Rel(r2->h2sess, r2);
return (0);
}
diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index 9a98fe700..8f3f5636e 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -116,18 +116,18 @@ xyzzy_vfp_rot13_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *
}
static int v_matchproto_(vdp_bytes_f)
-xyzzy_vfp_rot13_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+xyzzy_vfp_rot13_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
char *q;
const char *pp;
int i, j, retval = 0;
- CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
AN(priv);
AN(*priv);
if (len <= 0)
- return (VDP_bytes(vdx, act, ptr, len));
+ return (VDP_bytes(vdc, act, ptr, len));
AN(ptr);
if (act != VDP_END)
act = VDP_FLUSH;
@@ -142,14 +142,14 @@ xyzzy_vfp_rot13_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
else
q[i] = pp[j];
if (i == ROT13_BUFSZ - 1 && j < len - 1) {
- retval = VDP_bytes(vdx, VDP_FLUSH, q, ROT13_BUFSZ);
+ retval = VDP_bytes(vdc, VDP_FLUSH, q, ROT13_BUFSZ);
if (retval != 0)
return (retval);
i = -1;
}
}
if (i >= 0)
- retval = VDP_bytes(vdx, act, q, i);
+ retval = VDP_bytes(vdc, act, q, i);
return (retval);
}
@@ -212,7 +212,7 @@ static const struct vmod_priv_methods priv_pedantic_methods[1] = {{
}};
static int v_matchproto_(vdp_init_f)
-xyzzy_pedantic_init(VRT_CTX, struct vdp_ctx *vdx, void **priv,
+xyzzy_pedantic_init(VRT_CTX, struct vdp_ctx *vdc, void **priv,
struct objcore *oc)
{
struct vdp_state_s *vdps;
@@ -226,7 +226,7 @@ xyzzy_pedantic_init(VRT_CTX, struct vdp_ctx *vdx, void **priv,
return (-1);
assert(vdps->state == VDPS_NULL);
- p = VRT_priv_task(ctx, (void *)vdx);
+ p = VRT_priv_task(ctx, (void *)vdc);
if (p == NULL)
return (-1);
p->priv = vdps;
@@ -241,7 +241,7 @@ xyzzy_pedantic_init(VRT_CTX, struct vdp_ctx *vdx, void **priv,
}
static int v_matchproto_(vdp_bytes_f)
-xyzzy_pedantic_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
+xyzzy_pedantic_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
const void *ptr, ssize_t len)
{
struct vdp_state_s *vdps;
@@ -255,15 +255,15 @@ xyzzy_pedantic_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
else
vdps->state = VDPS_BYTES;
- return (VDP_bytes(vdx, act, ptr, len));
+ return (VDP_bytes(vdc, act, ptr, len));
}
static int v_matchproto_(vdp_fini_f)
-xyzzy_pedantic_fini(struct vdp_ctx *vdx, void **priv)
+xyzzy_pedantic_fini(struct vdp_ctx *vdc, void **priv)
{
struct vdp_state_s *vdps;
- (void) vdx;
+ (void) vdc;
AN(priv);
if (*priv == NULL)
return (0);
More information about the varnish-commit
mailing list