Skip to content
Snippets Groups Projects
Commit 01b3e68b authored by Peter Maydell's avatar Peter Maydell
Browse files

scripts/coccinelle: New script to remove unnecessary timer_del() calls


Now that timer_free() implicitly calls timer_del(), sequences
  timer_del(mytimer);
  timer_free(mytimer);

can be simplified to just
  timer_free(mytimer);

Add a Coccinelle script to do this transformation.

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Message-id: 20201215154107.3255-3-peter.maydell@linaro.org
parent 5f8e93c3
No related branches found
No related tags found
No related merge requests found
// Remove superfluous timer_del() calls
//
// Copyright Linaro Limited 2020
// This work is licensed under the terms of the GNU GPLv2 or later.
//
// spatch --macro-file scripts/cocci-macro-file.h \
// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \
// --in-place --dir .
//
// The timer_free() function now implicitly calls timer_del()
// for you, so calls to timer_del() immediately before the
// timer_free() of the same timer can be deleted.
@@
expression T;
@@
-timer_del(T);
timer_free(T);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment