[master] 7779839d8 Extend check_obj.cocci to the trivial base case

Nils Goroll nils.goroll at uplex.de
Thu Jul 28 08:19:07 UTC 2022


commit 7779839d8cc023ce79e024c24e97bc2e1b04bd74
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Jul 28 10:17:53 2022 +0200

    Extend check_obj.cocci to the trivial base case
    
    does not apply in varnish-cache, but found useful in a vmod

diff --git a/tools/coccinelle/check_obj.cocci b/tools/coccinelle/check_obj.cocci
index 37eff6b68..d82510210 100644
--- a/tools/coccinelle/check_obj.cocci
+++ b/tools/coccinelle/check_obj.cocci
@@ -1,5 +1,6 @@
 /*
- * This patch removes a redundant null check.
+ * This patch removes a redundant null check and replaces assertions
+ * on the magic with CHECK_OBJ()
  */
 
 @@
@@ -11,3 +12,10 @@ if (obj != NULL) {
 + CHECK_OBJ(obj, magic);
 ...
 }
+
+@@
+expression obj, magicval;
+@@
+
+- assert(obj->magic == magicval);
++ CHECK_OBJ(obj, magicval);


More information about the varnish-commit mailing list