Simplify code based on final review feedback

- Use direct character assignment for constant strings
- Remove unnecessary tracking array and cleanup code
- Simplify string concatenation logic
- Fix length calculation to match actual strncat behavior
- Code is cleaner and more maintainable

Co-authored-by: squassina <8495707+squassina@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-18 09:02:22 +00:00
parent 21088fe86a
commit 5d145cc80f
3 changed files with 11 additions and 23 deletions

View file

@ -77,9 +77,9 @@ void get_layout_abbr(char *abbr, const char *full_name) {
abbr[2] = '\0';
} else {
// 5. 最终回退:返回 "xx"
// Explicit null termination for consistency
strncpy(abbr, "xx", LAYOUT_ABBR_SIZE - 1);
abbr[LAYOUT_ABBR_SIZE - 1] = '\0';
abbr[0] = 'x';
abbr[1] = 'x';
abbr[2] = '\0';
}
}