diff options
author | 2024-06-07 15:06:43 +0200 | |
---|---|---|
committer | 2024-06-07 15:06:43 +0200 | |
commit | cc4f773b0e0f45cdb28727853b9d253234a93b56 (patch) | |
tree | 455224a7cb489909906eda5778d0e700867358d4 /vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_slice.go | |
parent | [feature] Implement filters_changed stream event (#2972) (diff) | |
download | gotosocial-cc4f773b0e0f45cdb28727853b9d253234a93b56.tar.xz |
[chore] Update WASM go-sqlite3 to v0.16.1 (#2976)
This includes support for journal mode set to WAL on the BSDs.
Relates to: #1753, #2962
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_slice.go')
-rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_slice.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_slice.go b/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_slice.go new file mode 100644 index 000000000..5072ca9c1 --- /dev/null +++ b/vendor/github.com/ncruces/go-sqlite3/internal/alloc/alloc_slice.go @@ -0,0 +1,24 @@ +//go:build !(darwin || linux) || !(amd64 || arm64 || riscv64) || sqlite3_noshm || sqlite3_nosys + +package alloc + +import "github.com/tetratelabs/wazero/experimental" + +func Slice(cap, _ uint64) experimental.LinearMemory { + return &sliceMemory{make([]byte, 0, cap)} +} + +type sliceMemory struct { + buf []byte +} + +func (b *sliceMemory) Free() {} + +func (b *sliceMemory) Reallocate(size uint64) []byte { + if cap := uint64(cap(b.buf)); size > cap { + b.buf = append(b.buf[:cap], make([]byte, size-cap)...) + } else { + b.buf = b.buf[:size] + } + return b.buf +} |