mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
cocci: Add semantic patch to refactor dns_name_dup() usage
This commit is contained in:
parent
a35b19f80e
commit
21902d0ac7
1 changed files with 40 additions and 0 deletions
40
cocci/dns_name_dup.spatch
Normal file
40
cocci/dns_name_dup.spatch
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
@@
|
||||
expression E1, E2, E3;
|
||||
statement S;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V = dns_name_dup(E1, E2, E3);
|
||||
+ dns_name_dup(E1, E2, E3);
|
||||
- if (V != ISC_R_SUCCESS) S
|
||||
|
||||
@@
|
||||
expression E1, E2, E3;
|
||||
statement S1, S2;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V = dns_name_dup(E1, E2, E3);
|
||||
- if (V != ISC_R_SUCCESS) S1 else { S2 }
|
||||
+ dns_name_dup(E1, E2, E3);
|
||||
+ S2
|
||||
|
||||
@@
|
||||
expression E1, E2, E3;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V = dns_name_dup(E1, E2, E3);
|
||||
- RUNTIME_CHECK(V == ISC_R_SUCCESS);
|
||||
+ dns_name_dup(E1, E2, E3);
|
||||
|
||||
@@
|
||||
expression E1, E2, E3;
|
||||
statement S1, S2;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V = dns_name_dup(E1, E2, E3);
|
||||
+ dns_name_dup(E1, E2, E3);
|
||||
S1
|
||||
- if (V != ISC_R_SUCCESS) S2
|
||||
Loading…
Reference in a new issue