]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add coccinelle script
authorEvan Hunt <each@isc.org>
Fri, 13 Jun 2025 05:19:27 +0000 (22:19 -0700)
committerEvan Hunt <each@isc.org>
Wed, 3 Dec 2025 21:45:43 +0000 (13:45 -0800)
add a semantic patch to prevent (most) future uses of the
CHECK and RETERR patterns.

cocci/check-reterr.spatch [new file with mode: 0644]

diff --git a/cocci/check-reterr.spatch b/cocci/check-reterr.spatch
new file mode 100644 (file)
index 0000000..bba9841
--- /dev/null
@@ -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);