Use clear builtin.

This commit is contained in:
Nuno Cruces
2023-08-09 16:12:52 +01:00
parent 4b280a3a7e
commit 772b9153c7
6 changed files with 21 additions and 15 deletions

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/ncruces/go-sqlite3
go 1.19
go 1.21
require (
github.com/ncruces/julianday v0.1.5

View File

@@ -1,4 +1,4 @@
go 1.19
go 1.21
use (
.

9
vfs/clear.go Normal file
View File

@@ -0,0 +1,9 @@
//go:build !go1.21
package vfs
func clear(b []byte) {
for i := range b {
b[i] = 0
}
}

10
vfs/memdb/clear.go Normal file
View File

@@ -0,0 +1,10 @@
//go:build !go1.21
package memdb
func clear[T any](b []T) {
var zero T
for i := range b {
b[i] = zero
}
}

View File

@@ -285,10 +285,3 @@ func divRoundUp(a, b int64) int64 {
func modRoundUp(a, b int64) int64 {
return b - (b-a%b)%b
}
func clear[T any](b []T) {
var zero T
for i := range b {
b[i] = zero
}
}

View File

@@ -432,9 +432,3 @@ func vfsErrorCode(err error, def _ErrorCode) _ErrorCode {
}
return def
}
func clear(b []byte) {
for i := range b {
b[i] = 0
}
}