tidy-up: TEXT() vs _TEXT() vs _T() use (Windows) - #22334
Closed
vszakats wants to merge 3 commits into
Closed
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Pull request overview
This PR standardizes Windows TCHAR literal macros to better reflect intent: _TEXT() (preferred over _T()) is used alongside CRT _tcs* functions, while TEXT() remains for Win32 API interactions, aligning with common Windows guidance.
Changes:
- Replaced
_T()with_TEXT()insrc/tool_main.cfor a CRT_tcscmp()comparison. - Replaced
TEXT()with_TEXT()in Schannel and SSPI CRT string parsing/comparison code. - Updated a Windows path-prefix check in
lib/curlx/fopen.cto use_TEXT().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tool_main.c | Uses _TEXT() for the CRT _tcscmp() option check on Windows. |
| lib/vtls/schannel.c | Uses _TEXT() for CRT _tcs* parsing of certificate store location strings. |
| lib/curlx/fopen.c | Uses _TEXT() for the CRT _tcsncmp() check of the \\?\ path prefix. |
| lib/curl_sspi.c | Uses _TEXT() for CRT _tcschr() parsing and empty-string literals in SSPI identity creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Any is fine, I've seen all of them used, most projects will define _UNICODE and UNICODE together for Unicode, so even though |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
_TEXT()when interacting with CRT functions (also prefer oversynonym
_T()),TEXT()for Win32 functions.Within curl, they mean the same because CRT/Win32 Unicode mode are
always enabled in sync.
Ref: https://devblogs.microsoft.com/oldnewthing/20040212-00/?p=40643/
I'm not firmly for
_TEXT()over_T(). Just assumed the former is theofficial macro based on Raymond not knowing about the short form. We
may stick with the short one, less symmetry, rarer, less greppable, but
shorter. Altogether rarely used in the code.