Skip to content

send: drop CURL_UNCONST() from buffer argument on most platforms#20463

Closed
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:swriteconst
Closed

send: drop CURL_UNCONST() from buffer argument on most platforms#20463
vszakats wants to merge 3 commits intocurl:masterfrom
vszakats:swriteconst

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 28, 2026

Keep it on platforms requiring a non-const buffer. These are AmigaOS and
OS400.

Also:

  • replace SEND_QUAL_ARG2 with boolean macro SEND_NONCONST_ARG2.

@vszakats vszakats marked this pull request as draft January 28, 2026 14:33
@vszakats vszakats changed the title send: try not to strip const on most platforms send: do not strip const on most platforms Jan 28, 2026
@vszakats vszakats changed the title send: do not strip const on most platforms send: stop stripping const from buffer argument on most platforms Jan 28, 2026
@vszakats vszakats marked this pull request as ready for review January 28, 2026 14:54
@vszakats vszakats requested a review from Copilot January 28, 2026 15:36
@vszakats
Copy link
Member Author

augment review

@vszakats
Copy link
Member Author

@aisle-analyzer

Copy link

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 pull request modernizes the handling of the send() function's buffer argument const qualifier by replacing a macro-based const qualifier approach with a simpler boolean flag approach. Previously, SEND_QUAL_ARG2 was used to strip const from the buffer argument on most platforms by default. The new approach uses SEND_NONCONST_ARG2 to explicitly mark the two platforms (AmigaOS and OS400) that require non-const buffers, while all other platforms now properly use const buffers.

Changes:

  • Replaced SEND_QUAL_ARG2 macro with boolean SEND_NONCONST_ARG2 macro
  • Updated swrite macro to conditionally apply const based on platform requirements
  • Removed legacy const-stripping logic from all config files except AmigaOS and OS400

Reviewed changes

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

Show a summary per file
File Description
projects/vms/config_h.com Removes SEND_QUAL_ARG2 handling from VMS configuration script
lib/functypes.h Defines SEND_NONCONST_ARG2 for AmigaOS and updates comment to reflect non-const signature
lib/curl_setup_once.h Implements conditional const handling in swrite macro and updates documentation
lib/config-win32.h Removes SEND_QUAL_ARG2 definition (Windows uses const by default)
lib/config-riscos.h Removes SEND_QUAL_ARG2 definition (RISC OS uses const by default)
lib/config-os400.h Replaces SEND_QUAL_ARG2 with SEND_NONCONST_ARG2 and updates comment
lib/config-mac.h Removes SEND_QUAL_ARG2 definition (Mac uses const by default)

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

@augmentcode
Copy link

augmentcode bot commented Jan 28, 2026

🤖 Augment PR Summary

Summary: This PR updates libcurl’s send() wrapper to preserve const on the buffer argument on most platforms.

Changes:

  • Remove `SEND_QUAL_ARG2` from several platform config headers and from `functypes.h`.
  • Introduce `SEND_NONCONST_ARG2` as a boolean macro to indicate platforms where `send()` requires a non-const buffer (AmigaOS, OS/400).
  • Adjust `swrite()` in curl_setup_once.h to only apply CURL_UNCONST() when `SEND_NONCONST_ARG2` is defined; otherwise pass a const-qualified pointer.
  • Update OS/400 and Amiga-specific definitions to set `SEND_NONCONST_ARG2`.
  • Remove VMS config generation handling for `SEND_QUAL_ARG2` since the qualifier macro is no longer used.

Technical Notes: Default behavior is now “ARG2 accepts const”; only platforms that truly need it must opt in via SEND_NONCONST_ARG2.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@vszakats vszakats changed the title send: stop stripping const from buffer argument on most platforms send: drop CURL_UNCONST() from buffer argument on most platforms Jan 29, 2026
@vszakats vszakats closed this in f95c79a Jan 29, 2026
@vszakats vszakats deleted the swriteconst branch January 29, 2026 02:42
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.

2 participants