qemu-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]