aboutsummaryrefslogtreecommitdiff
path: root/tools/coccinelle/hashmap.cocci
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-19 06:33:21 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-19 06:40:08 -0700
commit8ca1b4472ce97ae1d120608f9f02a86fa33d4187 (patch)
tree08c593382b995fb479d6f883db59ee7c175e2e0c /tools/coccinelle/hashmap.cocci
parent8872941fd21e2afe37032e7d9beec87b69aca9c9 (diff)
downloadgit-8ca1b4472ce97ae1d120608f9f02a86fa33d4187.tar.xz
contrib: move "coccinelle/" directory into "tools/"
The Coccinelle tool is an ingrained part of our build infrastructure. It is executed by our CI to detect antipatterns and is used to detect misuses of certain interfaces. It's presence in "contrib/" is thus rather misleading. Promote the configuration into the new "tools/" directory. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tools/coccinelle/hashmap.cocci')
-rw-r--r--tools/coccinelle/hashmap.cocci16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/coccinelle/hashmap.cocci b/tools/coccinelle/hashmap.cocci
new file mode 100644
index 0000000000..c5dbb4557b
--- /dev/null
+++ b/tools/coccinelle/hashmap.cocci
@@ -0,0 +1,16 @@
+@@
+expression E;
+struct hashmap_entry HME;
+@@
+- HME.hash = E;
++ hashmap_entry_init(&HME, E);
+
+@@
+identifier f !~ "^hashmap_entry_init$";
+expression E;
+struct hashmap_entry *HMEP;
+@@
+ f(...) {<...
+- HMEP->hash = E;
++ hashmap_entry_init(HMEP, E);
+ ...>}