From: Evan Hunt Date: Fri, 13 Jun 2025 05:19:27 +0000 (-0700) Subject: add coccinelle script X-Git-Tag: v9.21.16~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d83601c58ab1d470ff158de62c8ce51ff9f544d;p=thirdparty%2Fbind9.git add coccinelle script add a semantic patch to prevent (most) future uses of the CHECK and RETERR patterns. --- diff --git a/cocci/check-reterr.spatch b/cocci/check-reterr.spatch new file mode 100644 index 00000000000..bba9841b50d --- /dev/null +++ b/cocci/check-reterr.spatch @@ -0,0 +1,30 @@ +@@ +expression E1; +@@ + +- result = E1; +- if (result != ISC_R_SUCCESS) { +- goto cleanup; +- } ++ CHECK(E1); + +@@ +expression E1; +isc_result_t result; +@@ + +- result = E1; +- if (result != ISC_R_SUCCESS) { +- return result; +- } ++ RETERR(E1); + +@@ +expression E1; +@@ + +- result = E1; +- if (result != ISC_R_SUCCESS) { +- CHECK(result); +- } ++ CHECK(E1);