diff options
Diffstat (limited to 'vendor/codeberg.org/gruf/go-kv/format')
-rw-r--r-- | vendor/codeberg.org/gruf/go-kv/format/format.go | 6 | ||||
-rw-r--r-- | vendor/codeberg.org/gruf/go-kv/format/util.go | 5 |
2 files changed, 4 insertions, 7 deletions
diff --git a/vendor/codeberg.org/gruf/go-kv/format/format.go b/vendor/codeberg.org/gruf/go-kv/format/format.go index 5027c7c06..cd0b574ea 100644 --- a/vendor/codeberg.org/gruf/go-kv/format/format.go +++ b/vendor/codeberg.org/gruf/go-kv/format/format.go @@ -197,7 +197,8 @@ func (f format) AppendBytes(b []byte) { // Quoted only if spaces/requires escaping case f.Key(): - f.AppendStringSafe(b2s(b)) + s := byteutil.B2S(b) + f.AppendStringSafe(s) // Append as separate ASCII quoted bytes in slice case f.Verbose(): @@ -214,7 +215,8 @@ func (f format) AppendBytes(b []byte) { // Quoted only if spaces/requires escaping case f.Value(): - f.AppendStringSafe(b2s(b)) + s := byteutil.B2S(b) + f.AppendStringSafe(s) // Append as raw bytes default: diff --git a/vendor/codeberg.org/gruf/go-kv/format/util.go b/vendor/codeberg.org/gruf/go-kv/format/util.go index 79cb30981..dbb918952 100644 --- a/vendor/codeberg.org/gruf/go-kv/format/util.go +++ b/vendor/codeberg.org/gruf/go-kv/format/util.go @@ -98,8 +98,3 @@ func isNil(i interface{}) bool { type eface struct{ _type, data unsafe.Pointer } //nolint return (*(*eface)(unsafe.Pointer(&i))).data == nil //nolint } - -// b2s converts a byteslice to string without allocation. -func b2s(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} |