From 70d87f0ff0cc3fc6b38e1f111932c7523e9b8223 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 06:54:30 +0000 Subject: [chore]: Bump codeberg.org/gruf/go-kv from 1.6.3 to 1.6.4 (#2142) --- vendor/codeberg.org/gruf/go-kv/util.go | 37 ++++++---------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) (limited to 'vendor/codeberg.org/gruf/go-kv/util.go') diff --git a/vendor/codeberg.org/gruf/go-kv/util.go b/vendor/codeberg.org/gruf/go-kv/util.go index ebcd3e304..c0c8ccdab 100644 --- a/vendor/codeberg.org/gruf/go-kv/util.go +++ b/vendor/codeberg.org/gruf/go-kv/util.go @@ -18,7 +18,9 @@ func AppendQuoteString(buf *byteutil.Buffer, str string) { case len(str) == 1: // Append quote single byte. - appendQuoteByte(buf, str[0]) + buf.B = append(buf.B, '\'') + buf.B = append(buf.B, format.Byte2Str(str[0])...) + buf.B = append(buf.B, '\'') return case len(str) > format.SingleTermLine || !format.IsSafeASCII(str): @@ -63,7 +65,9 @@ func AppendQuoteValue(buf *byteutil.Buffer, str string) { case len(str) == 1: // Append quote single byte. - appendQuoteByte(buf, str[0]) + buf.B = append(buf.B, '\'') + buf.B = append(buf.B, format.Byte2Str(str[0])...) + buf.B = append(buf.B, '\'') return case len(str) > format.SingleTermLine || !format.IsSafeASCII(str): @@ -115,35 +119,6 @@ func AppendQuoteValue(buf *byteutil.Buffer, str string) { return } -// appendEscapeByte will append byte to buffer, quoting and escaping where necessary. -func appendQuoteByte(buf *byteutil.Buffer, c byte) { - switch c { - // Double quote space. - case ' ': - buf.B = append(buf.B, '"', c, '"') - - // Escape + double quote. - case '\a': - buf.B = append(buf.B, '"', '\\', 'a', '"') - case '\b': - buf.B = append(buf.B, '"', '\\', 'b', '"') - case '\f': - buf.B = append(buf.B, '"', '\\', 'f', '"') - case '\n': - buf.B = append(buf.B, '"', '\\', 'n', '"') - case '\r': - buf.B = append(buf.B, '"', '\\', 'r', '"') - case '\t': - buf.B = append(buf.B, '"', '\\', 't', '"') - case '\v': - buf.B = append(buf.B, '"', '\\', 'v', '"') - - // Append as-is. - default: - buf.B = append(buf.B, c) - } -} - // isQuoted checks if string is single or double quoted. func isQuoted(str string) bool { return (str[0] == '"' && str[len(str)-1] == '"') || -- cgit v1.2.3