git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] Add basic Coccinelle transforms.
@ 2016-06-07  0:57 brian m. carlson
  2016-06-07  0:57 ` [PATCH 2/8] Apply standard object_id Coccinelle transformations brian m. carlson
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: brian m. carlson @ 2016-06-07  0:57 UTC (permalink / raw)
  To: git; +Cc: Elijah Newren, Junio C Hamano, Stefan Beller, Jeff King

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.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
I realize the name and location of this file might be suboptimal.
Suggestions on better locations and filenames would be appreciated.

 standard.cocci | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 standard.cocci

diff --git a/standard.cocci b/standard.cocci
new file mode 100644
index 00000000..0f068252
--- /dev/null
+++ b/standard.cocci
@@ -0,0 +1,83 @@
+@@
+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;
+@@
+- 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)

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-06-07 23:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-07  0:57 [PATCH 1/8] Add basic Coccinelle transforms brian m. carlson
2016-06-07  0:57 ` [PATCH 2/8] Apply standard object_id Coccinelle transformations brian m. carlson
2016-06-07  0:57 ` [PATCH 3/8] Convert struct diff_filespec to struct object_id brian m. carlson
2016-06-07  0:57 ` [PATCH 4/8] Rename struct diff_filespec's sha1_valid member brian m. carlson
2016-06-07  6:21   ` Johannes Sixt
2016-06-07  6:23     ` Jeff King
2016-06-07 19:14       ` Junio C Hamano
2016-06-07 23:12         ` brian m. carlson
2016-06-07  0:57 ` [PATCH 5/8] merge-recursive: convert struct stage_data to use object_id brian m. carlson
2016-06-07  0:57 ` [PATCH 6/8] merge-recursive: convert struct merge_file_info to object_id brian m. carlson
2016-06-07  0:57 ` [PATCH 7/8] merge-recursive: convert leaf functions to use struct object_id brian m. carlson
2016-06-07  0:57 ` [PATCH 8/8] merge-recursive: convert merge_recursive_generic to object_id brian m. carlson
2016-06-07  2:28 ` [PATCH 1/8] Add basic Coccinelle transforms Junio C Hamano
2016-06-07  2:31   ` brian m. carlson
2016-06-07  2:54     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).