mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
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:
parent
21088fe86a
commit
5d145cc80f
3 changed files with 11 additions and 23 deletions
|
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue