summaryrefslogtreecommitdiff
path: root/vendor/modernc.org/libc/libc_all.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-04-01 15:24:11 +0000
committerLibravatar GitHub <noreply@github.com>2025-04-01 16:24:11 +0100
commitfdf23a91de791b813f65c244fd75e3262171f1b0 (patch)
tree6ad5045e17f4520386067e4334e749be09ae1510 /vendor/modernc.org/libc/libc_all.go
parentadd a security.md stub, until (if) we determine a fancier security process :w... (diff)
downloadgotosocial-fdf23a91de791b813f65c244fd75e3262171f1b0.tar.xz
update modernc.org/sqlite to v1.37.0-concurrrency-workaround (#3958)
Diffstat (limited to 'vendor/modernc.org/libc/libc_all.go')
-rw-r--r--vendor/modernc.org/libc/libc_all.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/modernc.org/libc/libc_all.go b/vendor/modernc.org/libc/libc_all.go
index 6e3b97764..7bc730b76 100644
--- a/vendor/modernc.org/libc/libc_all.go
+++ b/vendor/modernc.org/libc/libc_all.go
@@ -32,3 +32,21 @@ func X__sync_sub_and_fetch[T constraints.Integer](t *TLS, p uintptr, v T) T {
panic(todo(""))
}
}
+
+// GoString returns the value of a C string at s.
+func GoString(s uintptr) string {
+ if s == 0 {
+ return ""
+ }
+
+ p := s
+ for *(*byte)(unsafe.Pointer(p)) != 0 {
+ p++
+ }
+ return string(unsafe.Slice((*byte)(unsafe.Pointer(s)), p-s))
+}
+
+// GoBytes returns a byte slice from a C char* having length len bytes.
+func GoBytes(s uintptr, len int) []byte {
+ return unsafe.Slice((*byte)(unsafe.Pointer(s)), len)
+}