[master] 5a5d457cf cocci: Inspect BOC state from ObjWaitState()
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Oct 27 14:09:05 UTC 2025
commit 5a5d457cffa16ed5eabb015977ec23afc23a4c64
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Wed Oct 1 13:51:00 2025 +0200
cocci: Inspect BOC state from ObjWaitState()
After returning from ObjWaitState(), replace any access of
oc->boc->state with the one that was captured by the wait
loop.
diff --git a/tools/coccinelle/obj_wait_state_check.cocci b/tools/coccinelle/obj_wait_state_check.cocci
new file mode 100644
index 000000000..085a6182c
--- /dev/null
+++ b/tools/coccinelle/obj_wait_state_check.cocci
@@ -0,0 +1,39 @@
+/*
+ * Inspect the state returned by ObjWaitState().
+ */
+
+ at capture_state@
+identifier func;
+expression oc;
+@@
+
+ func(...)
+ {
+ ...
+-ObjWaitState(oc,
++state = ObjWaitState(oc,
+ ...);
+ ...
+-oc->boc->state
++state
+ ...
+ }
+
+ at declare_state@
+identifier capture_state.func;
+@@
+
+ func(...)
+ {
++enum boc_state_e state;
+ ...
+ }
+
+ at ignore_state@
+statement stmt;
+@@
+
+<...stmt...>
+-ObjWaitState(
++(void)ObjWaitState(
+ ...);
More information about the varnish-commit
mailing list