Re: [PATCH v3 1/4] cocci: add and apply a rule to find "unused" strbufs
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 1, 2022, 19:55 UTC
- Message-ID
- <CAPig+cSWpzHtv-Kv7=fibkPot=NTwKgc5_Eo_7G4fT=FnaGrxA@mail.gmail.com>
- In-Reply-To
- <patch-v3-1.4-49e9ccb5819-20220701T102506Z-avarab@gmail.com>
On Fri, Jul 1, 2022 at 6:36 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> 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.Show 8 quoted lines
> 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"?
Show 5 quoted lines
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > --- > 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/