Add semantic patch to fix isc_buffer_allocate usage, it cannot fail now

This commit is contained in:
Ondřej Surý 2020-02-02 08:00:45 +01:00
parent 4459745ff2
commit d5f682a00b

View file

@ -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);