]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add semantic patch to refactor isc_mempool_create() usage
authorOndřej Surý <ondrej@isc.org>
Sun, 2 Feb 2020 07:45:12 +0000 (08:45 +0100)
committerOndřej Surý <ondrej@isc.org>
Mon, 3 Feb 2020 07:27:12 +0000 (08:27 +0100)
cocci/isc_mempool_create_cannot_fail.cocci [new file with mode: 0644]

diff --git a/cocci/isc_mempool_create_cannot_fail.cocci b/cocci/isc_mempool_create_cannot_fail.cocci
new file mode 100644 (file)
index 0000000..f3509d2
--- /dev/null
@@ -0,0 +1,49 @@
+@@
+expression V;
+@@
+
+- V =
+  isc_mempool_create(...);
+- assert_int_equal(V, ISC_R_SUCCESS);
+
+@@
+expression V;
+@@
+
+- V =
+  isc_mempool_create(...);
+- check_result(V, ...);
+
+@@
+@@
+
+- CHECK(
+  isc_mempool_create(...)
+- )
+  ;
+
+@@
+@@
+
+- RUNTIME_CHECK(
+  isc_mempool_create(...)
+- == ISC_R_SUCCESS)
+  ;
+
+@@
+expression V;
+statement S;
+@@
+
+- V =
+  isc_mempool_create(...);
+- if (V != ISC_R_SUCCESS) S
+
+@@
+statement S;
+@@
+
+- if (
+  isc_mempool_create(...)
+- != ISC_R_SUCCESS) S
++ ;