Skip to content

noproxy: simplify, don't mix const non-const in strchr() - #20425

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/noprox-const
Closed

noproxy: simplify, don't mix const non-const in strchr()#20425
bagder wants to merge 1 commit into
masterfrom
bagder/noprox-const

Conversation

@bagder

@bagder bagder commented Jan 25, 2026

Copy link
Copy Markdown
Member

Ref: #20420

@bagder
bagder requested a review from Copilot January 25, 2026 09:50
@bagder
bagder marked this pull request as ready for review January 25, 2026 09:50

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 fixes a compilation error with glibc-2.43 where strchr() now returns a const-qualified pointer when called on a const string, which cannot be assigned to a non-const variable.

Changes:

  • Simplified match_ip() function in lib/noproxy.c by removing the intermediate check variable
  • Direct use of the checkip buffer (non-const) eliminates const qualifier mismatches

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

@bagder bagder closed this in 7dc60bd Jan 25, 2026
@bagder
bagder deleted the bagder/noprox-const branch January 25, 2026 10:02
vszakats added a commit that referenced this pull request Jan 25, 2026
Assisted-by: Rudi Heitbaum
Fixes #20420
Follow-up to 7dc60bd #20425
Follow-up to 0e2507a #20421

Closes #20428
vszakats added a commit that referenced this pull request Jun 18, 2026
Fixing (as seen with gcc-15 on Ubuntu 26.04):
```
lib/smb.c: In function 'smb_connect':
lib/smb.c:491:9: error: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  491 |   slash = strchr(user, '/');
      |         ^
lib/smb.c:493:11: error: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  493 |     slash = strchr(user, '\\');
      |           ^
```
Ref: https://github.com/curl/curl/actions/runs/27778098314/job/82195462418?pr=22092

Follow-up to 4e59083 #20428
Follow-up to 7dc60bd #20425
Follow-up to 0e2507a #20421

Cherry-picked from #22092

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