diff options
| author | 2025-04-14 09:43:56 +0200 | |
|---|---|---|
| committer | 2025-04-14 09:43:56 +0200 | |
| commit | 51b9ef5c346f333e558eca38fd954464322f3b7d (patch) | |
| tree | bf5cd0de887a27c1afc66345b1a464921d96e503 /vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go | |
| parent | [docs] Remind the user that password resets don't work without restarting. (#... (diff) | |
| download | gotosocial-51b9ef5c346f333e558eca38fd954464322f3b7d.tar.xz | |
[chore]: Bump github.com/gin-contrib/gzip from 1.2.2 to 1.2.3 (#4000)
Bumps [github.com/gin-contrib/gzip](https://github.com/gin-contrib/gzip) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/gin-contrib/gzip/releases)
- [Changelog](https://github.com/gin-contrib/gzip/blob/master/.goreleaser.yaml)
- [Commits](https://github.com/gin-contrib/gzip/compare/v1.2.2...v1.2.3)
---
updated-dependencies:
- dependency-name: github.com/gin-contrib/gzip
dependency-version: 1.2.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go')
| -rw-r--r-- | vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go b/vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go index 40b3e081f..010028203 100644 --- a/vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go +++ b/vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go @@ -32,7 +32,7 @@ const _PaddingSize = 32 type FieldLookup interface { Set(fields []resolver.FieldMeta) - Get(name string) int + Get(name string, caseSensitive bool) int } func isAscii(s string) bool { @@ -93,13 +93,15 @@ func (self *SmallFieldMap) Set(fields []resolver.FieldMeta) { } } -func (self *SmallFieldMap) Get(name string) int { +func (self *SmallFieldMap) Get(name string, caseSensitive bool) int { for i, k := range self.keys { if len(k) == len(name) && k == name { return i } } - + if caseSensitive { + return -1 + } name = strings.ToLower(name) for i, k := range self.lowerKeys { if len(k) == len(name) && k == name { @@ -153,16 +155,20 @@ const _HdrSlot = 33 const _HdrSize = _HdrSlot * 5 // use native SIMD to accelerate it -func (self *NormalFieldMap) Get(name string) int { +func (self *NormalFieldMap) Get(name string, caseSensitive bool) int { // small keys use native C if len(name) <= 32 { - _ = native.LookupSmallKey - return native.LookupSmallKey(&name, &self.keys, self.lowOffset); + _ = native.LookupSmallKey + lowOffset := self.lowOffset + if caseSensitive { + lowOffset = -1 + } + return native.LookupSmallKey(&name, &self.keys, lowOffset); } - return self.getLongKey(name) + return self.getLongKey(name, caseSensitive) } -func (self *NormalFieldMap) getLongKey(name string) int { +func (self *NormalFieldMap) getLongKey(name string, caseSensitive bool) int { for _, k := range self.longKeys { if len(k.key) != len(name) { continue; @@ -172,6 +178,10 @@ func (self *NormalFieldMap) getLongKey(name string) int { } } + if caseSensitive { + return -1 + } + lower := strings.ToLower(name) for _, k := range self.longKeys { if len(k.key) != len(name) { @@ -329,11 +339,13 @@ type FallbackFieldMap struct { } } - func (self *FallbackFieldMap) Get(name string) int { + func (self *FallbackFieldMap) Get(name string, caseSensitive bool) int { if i, ok := self.inner[name]; ok { return i - } else { + } else if !caseSensitive { return self.getCaseInsensitive(name) + } else { + return -1 } } |
