Skip to content

Commit 772b915

Browse files
committed
Use clear builtin.
1 parent 4b280a3 commit 772b915

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ncruces/go-sqlite3
22

3-
go 1.19
3+
go 1.21
44

55
require (
66
github.com/ncruces/julianday v0.1.5

go.work

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
go 1.19
1+
go 1.21
22

33
use (
44
.

vfs/clear.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//go:build !go1.21
2+
3+
package vfs
4+
5+
func clear(b []byte) {
6+
for i := range b {
7+
b[i] = 0
8+
}
9+
}

vfs/memdb/clear.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:build !go1.21
2+
3+
package memdb
4+
5+
func clear[T any](b []T) {
6+
var zero T
7+
for i := range b {
8+
b[i] = zero
9+
}
10+
}

vfs/memdb/memdb.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,3 @@ func divRoundUp(a, b int64) int64 {
285285
func modRoundUp(a, b int64) int64 {
286286
return b - (b-a%b)%b
287287
}
288-
289-
func clear[T any](b []T) {
290-
var zero T
291-
for i := range b {
292-
b[i] = zero
293-
}
294-
}

vfs/vfs.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,3 @@ func vfsErrorCode(err error, def _ErrorCode) _ErrorCode {
432432
}
433433
return def
434434
}
435-
436-
func clear(b []byte) {
437-
for i := range b {
438-
b[i] = 0
439-
}
440-
}

0 commit comments

Comments
 (0)