summaryrefslogtreecommitdiffstats
path: root/cocci/isc_buffer_allocate_never_fail.spatch
diff options
context:
space:
mode:
Diffstat (limited to 'cocci/isc_buffer_allocate_never_fail.spatch')
-rw-r--r--cocci/isc_buffer_allocate_never_fail.spatch84
1 files changed, 84 insertions, 0 deletions
diff --git a/cocci/isc_buffer_allocate_never_fail.spatch b/cocci/isc_buffer_allocate_never_fail.spatch
new file mode 100644
index 0000000..b632e4e
--- /dev/null
+++ b/cocci/isc_buffer_allocate_never_fail.spatch
@@ -0,0 +1,84 @@
+@@
+statement S;
+expression V;
+@@
+
+- V =
+ isc_buffer_allocate(...);
+- if (V != ISC_R_SUCCESS) S
+
+@@
+statement S1, S2;
+expression V;
+@@
+
+- V =
+ isc_buffer_allocate(...);
+- if (V == ISC_R_SUCCESS)
+ S1
+- else S2
+
+@@
+expression V;
+@@
+
+- V =
+ isc_buffer_allocate(...);
+- check_result(V, ...);
+
+@@
+@@
+
+- CHECK(
+ isc_buffer_allocate(...)
+- )
+ ;
+
+@@
+@@
+
+- DO(...,
+ isc_buffer_allocate(...)
+- )
+ ;
+
+@@
+@@
+
+- RETERR(
+ isc_buffer_allocate(...)
+- )
+ ;
+
+@@
+expression V;
+@@
+
+- V =
+ isc_buffer_allocate(...);
+- assert_int_equal(V, ISC_R_SUCCESS);
+
+@@
+expression V;
+@@
+
+- V =
+ isc_buffer_allocate(...);
+- CHECK(..., V);
+
+@@
+expression V;
+statement S;
+@@
+
+- V =
+ isc_buffer_allocate(...);
+- if (ISC_UNLIKELY(V != ISC_R_SUCCESS)) S
+
+@@
+expression V;
+@@
+
+- V =
+ isc_buffer_allocate(...);
+- RUNTIME_CHECK(V == ISC_R_SUCCESS);