summaryrefslogtreecommitdiff
path: root/vendor/github.com/buger/jsonparser/bytes.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-01-14 14:23:28 +0000
committerLibravatar GitHub <noreply@github.com>2025-01-14 14:23:28 +0000
commitb8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9 (patch)
tree68eaf966c80237e18993e887c8583355f0943ca7 /vendor/github.com/buger/jsonparser/bytes.go
parent[chore] better dns validation (#3644) (diff)
downloadgotosocial-b8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9.tar.xz
bump uptrace/bun dependencies from 1.2.6 to 1.2.8 (#3645)
Diffstat (limited to 'vendor/github.com/buger/jsonparser/bytes.go')
-rw-r--r--vendor/github.com/buger/jsonparser/bytes.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/vendor/github.com/buger/jsonparser/bytes.go b/vendor/github.com/buger/jsonparser/bytes.go
deleted file mode 100644
index 0bb0ff395..000000000
--- a/vendor/github.com/buger/jsonparser/bytes.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package jsonparser
-
-import (
- bio "bytes"
-)
-
-// minInt64 '-9223372036854775808' is the smallest representable number in int64
-const minInt64 = `9223372036854775808`
-
-// About 2x faster then strconv.ParseInt because it only supports base 10, which is enough for JSON
-func parseInt(bytes []byte) (v int64, ok bool, overflow bool) {
- if len(bytes) == 0 {
- return 0, false, false
- }
-
- var neg bool = false
- if bytes[0] == '-' {
- neg = true
- bytes = bytes[1:]
- }
-
- var b int64 = 0
- for _, c := range bytes {
- if c >= '0' && c <= '9' {
- b = (10 * v) + int64(c-'0')
- } else {
- return 0, false, false
- }
- if overflow = (b < v); overflow {
- break
- }
- v = b
- }
-
- if overflow {
- if neg && bio.Equal(bytes, []byte(minInt64)) {
- return b, true, false
- }
- return 0, false, true
- }
-
- if neg {
- return -v, true, false
- } else {
- return v, true, false
- }
-}