Skip to contentSkip to conversation

libtracefs: Fix the label usage in check_option()

PATCH Steven Rostedt 1 participant 2 messages Mar 13, 2023 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · On Sun, 12 Mar 2023 18:21:13 +0100 Markus Elfring <[email protected]> wrote:

Date: Sun, 12 Mar 2023 18:10:36 +0100

The label “out” was used to jump to a source code place after some failure cases. This implementation detail hindered better exception handling.

"out" is a perfectly fine name.

Quoted 4 lines

Use more appropriate labels instead.

* Reorder jump targets at the end.

Why?

Quoted 2 lines

* Delete a condition check.

Why?

Quoted 5 lines

* Omit an extra initialisation (for the variable “fd”) which became unnecessary with this change.

Fixes f7951864c7766ba3d683e8676fe0e497991796b2 ("libtracefs: Unit tests for tracing options APIs")

What was fixed???

utest/tracefs-utest.c

Quoted 9 lines

---
 utest/tracefs-utest.c | 18 +++++++++---------

 1 file changed, 9 insertions(+), 9 deletions(-)
utest/tracefs-utest.c +0 -0
index e0e3c07..d1ff6cf 100644

This is a test file. It's run in tests.

-- Steve

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 7 lines · On Mon, 13 Mar 2023 21:55:10 +0100 Markus Elfring <[email protected]> wrote:
Quoted 3 lines
Quoted 2 lines

The label “out” was used to jump to a source code place after some failure cases. This implementation detail hindered better exception handling.

"out" is a perfectly fine name.

I got the impression that this identifier can occasionally trigger undesirable side effects.

No it doesn't.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

Use more appropriate labels instead.

* Reorder jump targets at the end.

Why?

Resources should be released in the opposite order as they were allocated.

That's a preference not a mandate.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

* Delete a condition check.

Why?

Such extra code can be avoided.

So what?

Quoted 9 lines
Quoted 7 lines
Quoted 6 lines

* Omit an extra initialisation (for the variable “fd”) which became unnecessary with this change.

Fixes f7951864c7766ba3d683e8676fe0e497991796b2 ("libtracefs: Unit tests for tracing options APIs")

What was fixed???

The exception handling was improved, wasn't it?

No it wasn't.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

+++ b/utest/tracefs-utest.c

This is a test file. It's run in tests.

I propose to enhance it a bit.

It's not enhanced at all. It's just changing to different personal preferences and does not improve the code one iota!

-- Steve