Refactor the code to remove global variables

This commit is contained in:
Junegunn Choi
2024-05-07 16:58:17 +09:00
parent c5fb0c43f9
commit 4bedd33c59
7 changed files with 85 additions and 76 deletions

View File

@@ -312,7 +312,7 @@ func parseAnsiCode(s string, delimiter byte) (int, byte, string) {
// Inlined version of strconv.Atoi() that only handles positive
// integers and does not allocate on error.
code := 0
for _, ch := range sbytes(s) {
for _, ch := range stringBytes(s) {
ch -= '0'
if ch > 9 {
return -1, delimiter, remaining