diff options
Diffstat (limited to 'encode.go')
-rw-r--r-- | encode.go | 23 |
1 files changed, 0 insertions, 23 deletions
@@ -17,7 +17,6 @@ import ( "sort" "strconv" "strings" - "unicode/utf8" "unsafe" ) @@ -426,28 +425,6 @@ func encode(w io.Writer, val reflect.Value, escaper BackslashEscaper, quote bool } } -func encodeStringFromString(w io.Writer, escaper BackslashEscaper, str string) { - encodeWriteByte(w, '"') - for _, c := range str { - if _, err := writeStringChar(w, c, BackslashEscapeNone, escaper); err != nil { - panic(encodeError{err}) - } - } - encodeWriteByte(w, '"') -} - -func encodeStringFromBytes(w io.Writer, escaper BackslashEscaper, str []byte) { - encodeWriteByte(w, '"') - for i := 0; i < len(str); { - c, size := utf8.DecodeRune(str[i:]) - if _, err := writeStringChar(w, c, BackslashEscapeNone, escaper); err != nil { - panic(encodeError{err}) - } - i += size - } - encodeWriteByte(w, '"') -} - func encodeArray(w io.Writer, val reflect.Value, escaper BackslashEscaper, cycleDepth uint, cycleSeen map[any]struct{}) { encodeWriteByte(w, '[') n := val.Len() |