From: Eric Sunshine Date: Fri, 01 Jul 2022 19:55:57 GMT Subject: Re: [PATCH v3 1/4] cocci: add and apply a rule to find "unused" strbufs Message-ID: In-Reply-To: On Fri, Jul 1, 2022 at 6:36 AM Ævar Arnfjörð Bjarmason wrote: > Add a coccinelle rule to remove "struct strbuf" initialization > followed by calling "strbuf_release()" function. I'm probably being overly pedantic, but I tripped over this failing to mention that the strbuf is not used between the initialization and the release. That is, I had expected it to say: Add a coccinelle rule to remove "struct strbuf" initialization followed by calling "strbuf_release()" function without any uses of the strbuf in between. > See extensive commentary in the new "unused.cocci" for how it works, > and what it's intended to find and replace. > > The inclusion of "contrib/scalar/scalar.c" is because "spatch" was > manually run on it (we don't usually run spatch on contrib). > > The use of "with strict" here will be explained and amended in the > following commit. Did you mean "when strict"? > Signed-off-by: Ævar Arnfjörð Bjarmason > --- > diff --git a/contrib/coccinelle/unused.cocci b/contrib/coccinelle/unused.cocci > @@ -0,0 +1,61 @@ > +// This rule finds sequences of "unused" declerations and uses of s/declerations/declarations/ > +// To do do this we find (continued below)... s/do do/do/