summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/ast/api.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-10-13 16:49:53 +0200
committerLibravatar tobi <tobi.smethurst@protonmail.com>2025-10-17 15:32:55 +0200
commitea7eeada77a52fd58a9e1a949a39eccc7bce955a (patch)
treeede9f651d0bd7782b565883f9384341530f8320f /vendor/github.com/bytedance/sonic/ast/api.go
parent[bugfix] repeated posts on timeline endpoints (#4494) (diff)
downloadgotosocial-ea7eeada77a52fd58a9e1a949a39eccc7bce955a.tar.xz
[chore] update dependencies (#4495)
- github.com/coreos/go-oidc/v3: v3.15.0 -> v3.16.0 - github.com/go-playground/form/v4: v4.2.1 -> v4.3.0 - github.com/go-swagger/go-swagger: v0.32.3 -> v0.33.1 - golang.org/x/crypto: v0.42.0 -> v0.43.0 - golang.org/x/image: v0.31.0 -> v0.32.0 - golang.org/x/net: v0.45.0 -> v0.46.0 - golang.org/x/oauth2: v0.31.0 -> v0.32.0 - golang.org/x/sys: v0.36.0 -> v0.37.0 - golang.org/x/text: v0.29.0 -> v0.30.0 - modernc.org/sqlite: v1.39.0 -> v1.39.1 (w/ concurrency workaround) Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4495 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/bytedance/sonic/ast/api.go')
-rw-r--r--vendor/github.com/bytedance/sonic/ast/api.go65
1 files changed, 12 insertions, 53 deletions
diff --git a/vendor/github.com/bytedance/sonic/ast/api.go b/vendor/github.com/bytedance/sonic/ast/api.go
index 36151f270..b9d3c58ee 100644
--- a/vendor/github.com/bytedance/sonic/ast/api.go
+++ b/vendor/github.com/bytedance/sonic/ast/api.go
@@ -1,5 +1,5 @@
-//go:build (amd64 && go1.17 && !go1.25) || (arm64 && go1.20 && !go1.25)
-// +build amd64,go1.17,!go1.25 arm64,go1.20,!go1.25
+//go:build (amd64 && go1.17 && !go1.26) || (arm64 && go1.20 && !go1.26)
+// +build amd64,go1.17,!go1.26 arm64,go1.20,!go1.26
/*
* Copyright 2022 ByteDance Inc.
@@ -20,62 +20,21 @@
package ast
import (
- `runtime`
- `unsafe`
-
- `github.com/bytedance/sonic/encoder`
- `github.com/bytedance/sonic/internal/native`
- `github.com/bytedance/sonic/internal/native/types`
- `github.com/bytedance/sonic/internal/rt`
- uq `github.com/bytedance/sonic/unquote`
- `github.com/bytedance/sonic/utf8`
+ "runtime"
+ "unsafe"
+
+ "github.com/bytedance/sonic/encoder"
+ "github.com/bytedance/sonic/internal/encoder/alg"
+ "github.com/bytedance/sonic/internal/native"
+ "github.com/bytedance/sonic/internal/native/types"
+ "github.com/bytedance/sonic/internal/rt"
+ "github.com/bytedance/sonic/utf8"
)
var typeByte = rt.UnpackEface(byte(0)).Type
-//go:nocheckptr
func quote(buf *[]byte, val string) {
- *buf = append(*buf, '"')
- if len(val) == 0 {
- *buf = append(*buf, '"')
- return
- }
-
- sp := rt.IndexChar(val, 0)
- nb := len(val)
- b := (*rt.GoSlice)(unsafe.Pointer(buf))
-
- // input buffer
- for nb > 0 {
- // output buffer
- dp := unsafe.Pointer(uintptr(b.Ptr) + uintptr(b.Len))
- dn := b.Cap - b.Len
- // call native.Quote, dn is byte count it outputs
- ret := native.Quote(sp, nb, dp, &dn, 0)
- // update *buf length
- b.Len += dn
-
- // no need more output
- if ret >= 0 {
- break
- }
-
- // double buf size
- *b = rt.GrowSlice(typeByte, *b, b.Cap*2)
- // ret is the complement of consumed input
- ret = ^ret
- // update input buffer
- nb -= ret
- sp = unsafe.Pointer(uintptr(sp) + uintptr(ret))
- }
-
- runtime.KeepAlive(buf)
- runtime.KeepAlive(sp)
- *buf = append(*buf, '"')
-}
-
-func unquote(src string) (string, types.ParsingError) {
- return uq.String(src)
+ *buf = alg.Quote(*buf, val, false)
}
func (self *Parser) decodeValue() (val types.JsonState) {