Skip to content

Commit fdc70a0

Browse files
committed
use math.MaxInt32. related issue #238
1 parent 09259a5 commit fdc70a0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

callback.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,21 @@ import "C"
2222
import (
2323
"errors"
2424
"fmt"
25+
"math"
2526
"reflect"
2627
"unsafe"
2728
)
2829

2930
//export callbackTrampoline
3031
func callbackTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) {
31-
// TODO should create slice dynamically?
32-
args := (*[1 << 20]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
32+
args := (*[math.MaxInt32 - 1]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
3333
fi := (*functionInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx)))
3434
fi.Call(ctx, args)
3535
}
3636

3737
//export stepTrampoline
3838
func stepTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) {
39-
// TODO should create slice dynamically?
40-
args := (*[1 << 20]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
39+
args := (*[math.MaxInt32 - 1]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
4140
ai := (*aggInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx)))
4241
ai.Step(ctx, args)
4342
}

0 commit comments

Comments
 (0)