diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-01-26 22:31:32 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-01-29 21:01:42 -0700 |
commit | ff6dc0bc519886905e758a84e572f5e34d6c03d1 (patch) | |
tree | 8906c4b8bb0c7dc468419efc17b872db62a4e068 /encode.go | |
parent | d1b5bc1f05624614f43ef85597f4aa9d7a166d23 (diff) |
Move things between files
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() |