[master] b5f9f0b74 vtest: replace le->test with local variable

Nils Goroll nils.goroll at uplex.de
Tue Jan 12 22:11:12 UTC 2021


commit b5f9f0b74d771004acf08134f057bcea9aee3805
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Jan 12 20:38:15 2021 +0100

    vtest: replace le->test with local variable

diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c
index 89b4e6872..a567c8a91 100644
--- a/bin/varnishtest/vtc_logexp.c
+++ b/bin/varnishtest/vtc_logexp.c
@@ -268,32 +268,36 @@ static int
 logexp_match(struct logexp *le, const char *data, int vxid, int tag,
     int type, int len)
 {
+	struct logexp_test *test;
 	const char *legend;
 	int ok = 1, skip = 0;
 
-	if (le->test->vxid == LE_LAST) {
+	test = le->test;
+	AN(test);
+
+	if (test->vxid == LE_LAST) {
 		if (le->vxid_last != vxid)
 			ok = 0;
-	} else if (le->test->vxid >= 0) {
-		if (le->test->vxid != vxid)
+	} else if (test->vxid >= 0) {
+		if (test->vxid != vxid)
 			ok = 0;
 	}
-	if (le->test->tag == LE_LAST) {
+	if (test->tag == LE_LAST) {
 		if (le->tag_last != tag)
 			ok = 0;
-	} else if (le->test->tag >= 0) {
-		if (le->test->tag != tag)
+	} else if (test->tag >= 0) {
+		if (test->tag != tag)
 			ok = 0;
 	}
-	if (le->test->vre &&
-	    le->test->tag >= 0 &&
-	    le->test->tag == tag &&
-	    VRE_ERROR_NOMATCH == VRE_exec(le->test->vre, data,
+	if (test->vre &&
+	    test->tag >= 0 &&
+	    test->tag == tag &&
+	    VRE_ERROR_NOMATCH == VRE_exec(test->vre, data,
 		len, 0, 0, NULL, 0, NULL))
 		ok = 0;
 
-	if (!ok && (le->test->skip_max == LE_ANY ||
-		    le->test->skip_max > le->skip_cnt))
+	if (!ok && (test->skip_max == LE_ANY ||
+		    test->skip_max > le->skip_cnt))
 		skip = 1;
 
 	if (ok)


More information about the varnish-commit mailing list