Skip to content

refactor: Remove all explicit AsciiString instantiations from C strings#1916

Merged
xezon merged 3 commits intoTheSuperHackers:mainfrom
xezon:xezon/refactor-asciistring-unicodestring-instance-1
Nov 30, 2025
Merged

refactor: Remove all explicit AsciiString instantiations from C strings#1916
xezon merged 3 commits intoTheSuperHackers:mainfrom
xezon:xezon/refactor-asciistring-unicodestring-instance-1

Conversation

@xezon
Copy link

@xezon xezon commented Nov 26, 2025

This change removes all explicit AsciiString instantiations from C strings. It was applied with a script.

Risk should be low.

A risk from a refactor like this would be if a string pointer would be now compared.

const char* string;
if (string == AsciiString("Hello"))

to

const char* string;
if (string == "Hello")

But I reviewed all changes and there were only 2 comparisons and both of them are ok, comparing against an AsciiString.

This change does cut a lot of superfluous AsciiString allocations when no longer creating AsciiString from C string when calling into TheNameKeyGenerator->nameToKey, because that function needs no AsciiString to work.

UnicodeString needed no touching. No more occurences were found.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Performance Is a performance concern Refactor Edits the code with insignificant behavior changes, is never user facing labels Nov 26, 2025
Copy link

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

I reviewed Generals and core. I pressume GeneralsMD is the same. Comments in Generals also apply to GeneralsMD

@xezon xezon force-pushed the xezon/refactor-asciistring-unicodestring-instance-1 branch from e61e2cd to dc17ca0 Compare November 29, 2025 19:58
@xezon xezon requested a review from Skyaero42 November 29, 2025 20:01
Copy link

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

Well done

@xezon xezon merged commit 7751544 into TheSuperHackers:main Nov 30, 2025
23 checks passed
@xezon xezon deleted the xezon/refactor-asciistring-unicodestring-instance-1 branch November 30, 2025 16:21
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Severity: Minor < Major < Critical < Blocker Performance Is a performance concern Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants