Skip to content

misc: fix code quality findings#21393

Closed
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:cq
Closed

misc: fix code quality findings#21393
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:cq

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented Apr 21, 2026

Pointed out by Copilot Code Quality

"Lines 250-251 check for NULL values and return early, but line 252
redundantly checks the same conditions (data->conn && rr). The redundant
checks on line 252 should be removed since they are already verified by
the early return."

pointed out by Copilot Code Quality
pointed out by Copilot Code Quality

Follow-up to 2b3dfb4
pointed out by Copilot Code Quality
"The raw mode check at line 1901 is redundant with the check at line
1881. The first check already returns early if ws_raw_mode is enabled,
so this second check will never be true."

pointed out by Copilot Code Quality

Follow-up to 37cecfc
pointed out by Copilot Code Quality

Follow-up to b889408 curl#3804
Copy link
Copy Markdown

Copilot AI left a comment

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 addresses static/code quality findings across the tool and lib layers, primarily by removing redundant checks/comments, correcting a typo, and fixing VMS-specific build breakage in the curl tool.

Changes:

  • Fix VMS build issues in tool_operate by using the correct per-transfer fields when calling VMS helpers / opening output files.
  • Simplify HTTPS-RR applicability logic and remove an obsolete struct comment.
  • WebSocket cleanup: remove a redundant raw-mode check in curl_ws_start_frame() and fix a typo in a comment.

Reviewed changes

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

File Description
src/tool_operate.c Fixes VMS-specific references to use per->uploadfile / per->outfile, restoring build correctness.
lib/ws.c Cleans up redundant checking in curl_ws_start_frame() and fixes a comment typo.
lib/httpsrr.h Removes an obsolete/incorrect comment about port.
lib/httpsrr.c Removes redundant conditions in Curl_httpsrr_applicable() for clarity.
Comments suppressed due to low confidence (1)

lib/ws.c:1885

  • curl_ws_start_frame() is a public API, and this change alters the observable error contract in raw mode (previously CURLE_SEND_ERROR with a [WS] ... message; now CURLE_FAILED_INIT with a different message and it also skips the usual [WS] prefix used throughout this file). To avoid breaking callers that check specific CURLcode values / messages, consider keeping the previous CURLcode and error text (or document the new error code in the manpage and align the message prefixing with other WS errors).
  if(data->set.ws_raw_mode) {
    failf(data, "cannot curl_ws_start_frame() with CURLWS_RAW_MODE enabled");
    return CURLE_FAILED_INIT;
  }

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

@vszakats vszakats closed this in 8eb3cb7 Apr 21, 2026
@vszakats vszakats deleted the cq branch April 21, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants