Skip to content

tidy-up: add missing, and drop redundant parentheses - #1898

Closed
vszakats wants to merge 19 commits into
libssh2:masterfrom
vszakats:dropparen
Closed

vszakats wants to merge 19 commits into
libssh2:masterfrom
vszakats:dropparen

Conversation

@vszakats

@vszakats vszakats commented Apr 29, 2026 •

Copy link
Copy Markdown
Member

Also:

  • apply minor whitespace fixes.
  • VMS/man2help.c: clarify if expression, drop redundant else
    expression.

Follow-up to 6e47049 #1844


https://github.com/libssh2/libssh2/pull/1898/files?w=1

@vszakats vszakats changed the title src: drop redundant parentheses src: drop redundant, and add missing parentheses Apr 29, 2026
@vszakats vszakats changed the title src: drop redundant, and add missing parentheses src: add missing, and drop redundant parentheses Apr 29, 2026
@vszakats vszakats changed the title src: add missing, and drop redundant parentheses tidy-up: add missing, and drop redundant parentheses Apr 29, 2026
@vszakats
vszakats requested a review from Copilot April 29, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a clang-tidy–style follow-up cleanup that standardizes formatting and simplifies some redundant expressions across the codebase (including public headers and docs).

Changes:

  • Simplify boolean/bitmask checks and remove redundant else branches (e.g., VMS helper code).
  • Normalize function-pointer macro usage and casts by removing redundant parentheses around declarators.
  • Apply minor whitespace/parentheses cleanups in macros, calls, and documentation snippets for consistency.

Reviewed changes

Copilot reviewed 24 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vms/man2help.c Clarifies VMS status-bit test and removes redundant else nesting.
src/wincng.c Small whitespace/parentheses tidying in conditions, casts, and calls.
src/userauth.h Normalizes function-pointer macro declarator style in prototypes.
src/userauth.c Normalizes function-pointer macro declarator style in definitions/prototypes.
src/transport.c Minor whitespace normalization in an expression.
src/session.c Updates callback function-pointer declarations/casts to the new macro style.
src/openssl.h Simplifies _libssh2_random macro formatting/parentheses.
src/mac.c Minor whitespace normalization in memcpy casts.
src/libssh2_priv.h Normalizes function-pointer fields in internal structs.
src/libgcrypt.h Drops redundant parentheses in macro args and adjusts continuation indentation.
src/kex.c Removes redundant parentheses in a local helper macro’s calls/args.
src/chacha.c Macro whitespace/parentheses cleanup for internal ChaCha helpers.
src/blowfish.c Minor macro formatting normalization.
os400/include/sys/socket.h Simplifies macro wrapper argument parentheses.
include/libssh2_sftp.h Simplifies convenience macro wrappers by dropping redundant parentheses.
include/libssh2_publickey.h Simplifies convenience macro wrappers by dropping redundant parentheses.
include/libssh2.h Normalizes public callback macro declarators and related prototypes/macros.
example/sftp_append.c Minor cast whitespace tweak in a debug print.
docs/libssh2_userauth_publickey_sk.md Sync docs signature formatting with header changes.
docs/libssh2_userauth_password_ex.md Sync docs signature/macro formatting with header changes.
docs/libssh2_userauth_keyboard_interactive.md Sync docs signature formatting with header changes.
docs/libssh2_sign_sk.md Sync docs struct signature formatting with header changes.
docs/libssh2_sftp_symlink.md Sync docs macro formatting with header changes.
docs/libssh2_sftp_rmdir.md Sync docs macro formatting with header changes.
docs/libssh2_sftp_realpath.md Sync docs macro formatting with header changes.
docs/libssh2_sftp_readlink.md Sync docs macro formatting with header changes.
docs/libssh2_sftp_fstat_ex.md Sync docs macro formatting with header changes.
docs/libssh2_session_init_ex.md Sync docs prototype formatting with header changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats closed this in b6f307d Apr 29, 2026
@vszakats
vszakats deleted the dropparen branch April 29, 2026 17:53
vszakats added a commit that referenced this pull request Jun 4, 2026
Also:
- drop redundant parentheses from
  `LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC()` arg.
  Follow-up to b6f307d #1898

Follow-up to f0279a6 #1964
Follow-up to e85ce25 #1960
Follow-up to 1db4083 #1938
Follow-up to 63e5948 #1936
Follow-up to 6ffb963 #1935

Closes #1968
vszakats added a commit that referenced this pull request Sep 3, 2026
To avoid the chance of breaking compatibility. Make an exception for
values also passed to `strlen()` because these were already not
supporting callers passing `x, y`-style macro expressions to these
macros, as arguments.

Also note that SFTP handle args already did not support this due to the
lack of parentheses in `libssh2_sftp_close()`, `libssh2_sftp_closedir()`
macros.

Follow-up to b6f307d #1898

Closes #2577
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