refactor(ini): Clean up INI type table and improve search logic#2511
Open
Caball009 wants to merge 3 commits intoTheSuperHackers:mainfrom
Open
refactor(ini): Clean up INI type table and improve search logic#2511Caball009 wants to merge 3 commits intoTheSuperHackers:mainfrom
Caball009 wants to merge 3 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/Common/INI/INI.cpp | Alphabetically sorted theTypeTable, removed null sentinel entry, and updated findBlockParse to use ARRAY_SIZE-bounded loop — all changes are correct and safe. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["findBlockParse(token)"] --> B["Loop: i = 0 to ARRAY_SIZE(theTypeTable)-1"]
B --> C{"strcmp(theTypeTable[i].token, token) == 0?"}
C -- Yes --> D["return theTypeTable[i].parse"]
C -- No --> E{"i < ARRAY_SIZE?"}
E -- Yes --> B
E -- No --> F["return nullptr"]
Reviews (1): Last reviewed commit: "Simplified loop logic." | Re-trigger Greptile
xezon
approved these changes
Apr 1, 2026
xezon
left a comment
There was a problem hiding this comment.
Looks reasonable. Why is this labeled as performance? If you want to optimize lookups, perhaps make a change where the type table is accessible with a map.
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.
This PR cleans up
theTypeTableand puts it in alphabetical order. It also changes the loop logic, so that the last value doesn't need to be a sentinel value for the loop logic.See commits for a cleaner diff.