Skip to content

Commit 91d3dd4

Browse files
committed
remove BindableColumn.smallBuf to silence CGO runtime checker
Fixes alexbrainman#65
1 parent 0b921e2 commit 91d3dd4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

column.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,18 @@ type BindableColumn struct {
177177
Size int
178178
Len BufferLen
179179
Buffer []byte
180-
smallBuf [8]byte // small inline memory buffer, so we do not need allocate external memory all the time
181180
}
182181

182+
// TODO(brainman): BindableColumn.Buffer is used by external code after external code returns - that needs to be avoided in the future
183+
183184
func NewBindableColumn(b *BaseColumn, ctype api.SQLSMALLINT, bufSize int) *BindableColumn {
184185
b.CType = ctype
185186
c := &BindableColumn{BaseColumn: b, Size: bufSize}
186-
if c.Size <= len(c.smallBuf) {
187-
// use inline buffer
188-
c.Buffer = c.smallBuf[:c.Size]
189-
} else {
190-
c.Buffer = make([]byte, c.Size)
187+
l := 8 // always use small starting buffer
188+
if c.Size > l {
189+
l = c.Size
191190
}
191+
c.Buffer = make([]byte, l)
192192
return c
193193
}
194194

0 commit comments

Comments
 (0)