Skip to content

Small code quality fixups #2164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2025
Merged

Conversation

cheesestraws
Copy link
Contributor

Just a couple of small fixups not really connected to anything else but which were trivial to fix while I was passing

  1. A slight tidying of includes and formatting.
  2. While #define FUCKED gave me a real surge of empathy for whoever wrote that code, it is in fact redundant, since it looks like it's been permanently defined for the last 25 years; I think we can get rid of the ifdefs now.

@cheesestraws cheesestraws requested a review from rdmark as a code owner May 14, 2025 10:36
@cheesestraws
Copy link
Contributor Author

Weird. I ran astyle locally and it didn't do that. OK, will reformat again...

@rdmark
Copy link
Member

rdmark commented May 14, 2025

I’m having second thoughts about the line break between function definition and the opening brace. I can try tweaking the rules tonight and see if we can consistently get the brace on the same line instead for all types of blocks.

@cheesestraws
Copy link
Contributor Author

I personally do prefer it - I thought 1tbs was meant to have the brace on the opening line, like all the other multi-line blocks.

@rdmark
Copy link
Member

rdmark commented May 14, 2025

The astyle interpretation of 1tbs is as follows, quoting the relevant passage:

Opening braces are broken from namespaces, classes, and function definitions. The braces are attached to everything else, including arrays, structs, enums, and statements within a function.

https://astyle.sourceforge.net/astyle.html#_style=1tbs

The reason I feel iffy about this rule on second thought, is the apparent inconsistency. There is surely an underlying logic, but it's not obvious at a glance.

While I appreciate the extra contextual information about the problem space
which is communicated by the macro name, it's still permanently set, so the
macro and its ifdefs are redundant.  The command line options it gates are
already documented as fixtures in the man page.
@cheesestraws
Copy link
Contributor Author

Well, I obviously misremembered what brace styles were called then, which isn't that surprising... sigh.

Anyway, here it is formatted according to the current rules, since we may as well be consistent

@rdmark rdmark merged commit 09c1ba0 into Netatalk:main May 15, 2025
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants