diff options
author | René Scharfe <l.s.r@web.de> | 2017-06-25 10:01:04 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-25 10:51:25 -0700 |
commit | f8bb4631fb7c97dd9f035a89404fa6beab5867df (patch) | |
tree | d29755913b4f57e9b56c5c50374d83e7a934af74 /builtin/am.c | |
parent | 88ce3ef636b1385e861ec0e9e2155248b999b032 (diff) | |
download | git-f8bb4631fb7c97dd9f035a89404fa6beab5867df.tar.gz |
coccinelle: add a rule to make "expression" code use FREE_AND_NULL()
Am 16.06.2017 um 21:43 schrieb Junio C Hamano:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> A follow-up to the existing "type" rule added in an earlier
>> change. This catches some occurrences that are missed by the previous
>> rule.
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> ---
>
> Hmph, I wonder if the "type" thing is really needed. Over there,
> "ptr" is an expression and we can find "free(ptr); ptr = NULL" with
> the rule in this patch already, no?
Indeed. How about this on top of master?
-- >8 --
Subject: [PATCH] coccinelle: polish FREE_AND_NULL rules
There are two rules for using FREE_AND_NULL in free.cocci, one for
pointer types and one for expressions. Both cause coccinelle to remove
empty lines and even newline characters between replacements for some
reason; consecutive "free(x);/x=NULL;" sequences end up as multiple
FREE_AND_NULL calls on the same time.
Remove the type rule, as the expression rule already covers it, and
rearrange the lines of the latter to place the addition of FREE_AND_NULL
between the removals, which causes coccinelle to leave surrounding
whitespace untouched.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/am.c')
0 files changed, 0 insertions, 0 deletions