[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 00/59] trivial unneeded labels cleanup
From: |
Daniel Henrique Barboza |
Subject: |
Re: [PATCH v1 00/59] trivial unneeded labels cleanup |
Date: |
Mon, 6 Jan 2020 17:35:49 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 |
On 1/6/20 4:54 PM, Corey Minyard wrote:
On Mon, Jan 06, 2020 at 03:23:26PM -0300, Daniel Henrique Barboza wrote:
Hello,
[...]
Which is cleaner and requires less brain cycles to wonder
whether the 'cleanup' label does anything special, such
as a heap memory cleanup.
I would disagree with this analysis. To me, I often wonder
when I have to add cleanup code to a routine whether there is
some hidden return in the middle of the function. That's a lot
harder to spot than just looking for the cleanup label at the
end of the function to see what it does. For non-trivial
functions I prefer to have one point of return at the end
(and maybe some minor checks with returns right at the beginning).
I'm not adamant about this, just my opinion.
I agree that what I'm doing here isn't a one rule fits all situation. This
is why I didn't purge all the 'unused' labels I found. The criteria used to
remove/spare labels will differ from person to person (although I believe that
cases such as patch 15 isn't too much of a debate), thus I'd rather leave to
each maintainer to accept/deny the changes based on the context of the code.
And for this same reason I don't think that a checkpatch rule is necessary.
The review process can take care of these situations and allow 'good unneeded
labels' to be in the code.
Thanks,
DHB
But if we are going to fix things like this, it might be best to add
them to the coding style document and checkpatch script. Otherwise
these sorts of things will just continue.
-corey
- [PATCH v1 53/59] net/net_tx_pkt.c: remove unneeded label in net_tx_pkt_get_gso_type(), (continued)
- [PATCH v1 53/59] net/net_tx_pkt.c: remove unneeded label in net_tx_pkt_get_gso_type(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 54/59] ivshmem-server/main.c: remove unneeded label in main(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 55/59] linux-user/flatload.c: remove unused 'out' label, Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 56/59] linux-user/signal.c: remove unneeded label in do_sigaltstack(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 57/59] linux-user/syscall.c: fix trailing whitespaces and style, Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 58/59] linux-user/syscall.c: remove unneeded labels, Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 59/59] linux-user/vm86.c: remove unneeded label in do_vm86(), Daniel Henrique Barboza, 2020/01/06
- Re: [PATCH v1 00/59] trivial unneeded labels cleanup, Corey Minyard, 2020/01/06
Re: [PATCH v1 00/59] trivial unneeded labels cleanup, Markus Armbruster, 2020/01/13
Re: [PATCH v1 00/59] trivial unneeded labels cleanup, Max Reitz, 2020/01/07
Re: [PATCH v1 00/59] trivial unneeded labels cleanup, Eric Blake, 2020/01/10