mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
contrib/coccinelle: add basic Coccinelle transforms
Coccinelle (http://coccinelle.lip6.fr/) is a program which performs mechanical transformations on C programs using semantic patches. These semantic patches can be used to implement automatic refactoring and maintenance tasks. Add a set of basic semantic patches to convert common patterns related to the struct object_id transformation, as well as a README. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
55c529a700
commit
db1d80b8fa
2
contrib/coccinelle/README
Normal file
2
contrib/coccinelle/README
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
This directory provides examples of Coccinelle (http://coccinelle.lip6.fr/)
|
||||||
|
semantic patches that might be useful to developers.
|
95
contrib/coccinelle/object_id.cocci
Normal file
95
contrib/coccinelle/object_id.cocci
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- is_null_sha1(E1.hash)
|
||||||
|
+ is_null_oid(&E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- is_null_sha1(E1->hash)
|
||||||
|
+ is_null_oid(E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- sha1_to_hex(E1.hash)
|
||||||
|
+ oid_to_hex(&E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- sha1_to_hex(E1->hash)
|
||||||
|
+ oid_to_hex(E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- sha1_to_hex_r(E1.hash)
|
||||||
|
+ oid_to_hex_r(&E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- sha1_to_hex_r(E1->hash)
|
||||||
|
+ oid_to_hex_r(E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- hashclr(E1.hash)
|
||||||
|
+ oidclr(&E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1;
|
||||||
|
@@
|
||||||
|
- hashclr(E1->hash)
|
||||||
|
+ oidclr(E1)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcmp(E1.hash, E2.hash)
|
||||||
|
+ oidcmp(&E1, &E2)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcmp(E1->hash, E2->hash)
|
||||||
|
+ oidcmp(E1, E2)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcmp(E1->hash, E2.hash)
|
||||||
|
+ oidcmp(E1, &E2)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcmp(E1.hash, E2->hash)
|
||||||
|
+ oidcmp(&E1, E2)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcpy(E1.hash, E2.hash)
|
||||||
|
+ oidcpy(&E1, &E2)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcpy(E1->hash, E2->hash)
|
||||||
|
+ oidcpy(E1, E2)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcpy(E1->hash, E2.hash)
|
||||||
|
+ oidcpy(E1, &E2)
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E1, E2;
|
||||||
|
@@
|
||||||
|
- hashcpy(E1.hash, E2->hash)
|
||||||
|
+ oidcpy(&E1, E2)
|
Loading…
Reference in a new issue