summaryrefslogtreecommitdiff
path: root/vendor/github.com/vmihailenco/msgpack/v5/intern.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-01-15 14:08:07 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-15 14:08:07 +0100
commit6433a505820cfeb43990a3453a0ed8b24e432b7d (patch)
tree3f968a63d6a77991df95fde88ee0f08727f26eb6 /vendor/github.com/vmihailenco/msgpack/v5/intern.go
parent[chore]: Bump github.com/tdewolff/minify/v2 from 2.20.12 to 2.20.14 (#2530) (diff)
downloadgotosocial-6433a505820cfeb43990a3453a0ed8b24e432b7d.tar.xz
[chore] update bun + extras v1.1.16 -> v1.1.17 (#2534)
Diffstat (limited to 'vendor/github.com/vmihailenco/msgpack/v5/intern.go')
-rw-r--r--vendor/github.com/vmihailenco/msgpack/v5/intern.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/vendor/github.com/vmihailenco/msgpack/v5/intern.go b/vendor/github.com/vmihailenco/msgpack/v5/intern.go
index be0316a83..7f019aaac 100644
--- a/vendor/github.com/vmihailenco/msgpack/v5/intern.go
+++ b/vendor/github.com/vmihailenco/msgpack/v5/intern.go
@@ -57,18 +57,16 @@ func encodeInternedStringValue(e *Encoder, v reflect.Value) error {
func (e *Encoder) encodeInternedString(s string, intern bool) error {
// Interned string takes at least 3 bytes. Plain string 1 byte + string len.
- if len(s) >= minInternedStringLen {
- if idx, ok := e.dict[s]; ok {
- return e.encodeInternedStringIndex(idx)
- }
+ if idx, ok := e.dict[s]; ok {
+ return e.encodeInternedStringIndex(idx)
+ }
- if intern && len(e.dict) < maxDictLen {
- if e.dict == nil {
- e.dict = make(map[string]int)
- }
- idx := len(e.dict)
- e.dict[s] = idx
+ if intern && len(s) >= minInternedStringLen && len(e.dict) < maxDictLen {
+ if e.dict == nil {
+ e.dict = make(map[string]int)
}
+ idx := len(e.dict)
+ e.dict[s] = idx
}
return e.encodeNormalString(s)