[master] cb95b6af4 Revert "re-apply tools/coccinelle/replace.cocci"

Nils Goroll nils.goroll at uplex.de
Wed Feb 10 08:32:08 UTC 2021


commit cb95b6af4a99e7cc185f171835ade80ed4374ea0
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Feb 10 09:28:36 2021 +0100

    Revert "re-apply tools/coccinelle/replace.cocci"
    
    Either flexelint or me, probabbly the latter, do not understand the
    code.
    
    As far as I am concerned, I would have thought that flexelint could
    follow for
    
            AN(y);
            REPLACE(x, y);
    
    x being guranteed to be non-NULL
    
    This reverts commit 897e5313ac1615d65ed51b6419995ecb926c3f49.
    This reverts commit 6f4d0ec16741468e6ff1842cc6dcfcdcfc36c3cf.

diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 87c58e7f5..017c53950 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -111,11 +111,13 @@ macro_def_int(const char *name, const char *fmt, va_list ap)
 		ALLOC_OBJ(m, MACRO_MAGIC);
 		AN(m);
 		REPLACE(m->name, name);
+		AN(m->name);
 		VTAILQ_INSERT_TAIL(&macro_list, m, list);
 	}
 	AN(m);
 	vbprintf(buf, fmt, ap);
 	REPLACE(m->val, buf);
+	AN(m->val);
 	return (m);
 }
 
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index a5f32a4cf..dc286066a 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -805,9 +805,9 @@ http_tx_parse_args(char * const *av, struct vtclog *vl, struct http *hp,
 	for (; *av != NULL; av++) {
 		if (!strcmp(*av, "-body")) {
 			assert(body == nullbody);
-			AN(av[1]);
 			REPLACE(body, av[1]);
 
+			AN(body);
 			av++;
 			bodylen = strlen(body);
 			for (b = body; *b != '\0'; b++) {
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index 0d6d4b5bd..f2deff037 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -1547,8 +1547,8 @@ cmd_tx11obj(CMD_ARGS)
 		else if (CMD_IS("txreq") || CMD_IS("txresp")) {
 			if (AV_IS("-body")) {
 				AZ(body);
-				AN(av[1]);
 				REPLACE(body, av[1]);
+				AN(body);
 				bodylen = strlen(body);
 				f.flags &= ~END_STREAM;
 				av++;
@@ -2580,6 +2580,7 @@ stream_new(const char *name, struct http *h)
 	AN(s);
 	AZ(pthread_cond_init(&s->cond, NULL));
 	REPLACE(s->name, name);
+	AN(s->name);
 	VTAILQ_INIT(&s->fq);
 	s->ws = h->iws;
 	s->vl = vtc_logopen("%s.%s", h->sess->name, name);


More information about the varnish-commit mailing list