Skip to content

Commit

Permalink
remove BindableColumn.smallBuf to silence CGO runtime checker
Browse files Browse the repository at this point in the history
Fixes #65
  • Loading branch information
alexbrainman committed Apr 8, 2016
1 parent 0b921e2 commit 91d3dd4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions column.go
Expand Up @@ -177,18 +177,18 @@ type BindableColumn struct {
Size int
Len BufferLen
Buffer []byte
smallBuf [8]byte // small inline memory buffer, so we do not need allocate external memory all the time
}

// TODO(brainman): BindableColumn.Buffer is used by external code after external code returns - that needs to be avoided in the future

func NewBindableColumn(b *BaseColumn, ctype api.SQLSMALLINT, bufSize int) *BindableColumn {
b.CType = ctype
c := &BindableColumn{BaseColumn: b, Size: bufSize}
if c.Size <= len(c.smallBuf) {
// use inline buffer
c.Buffer = c.smallBuf[:c.Size]
} else {
c.Buffer = make([]byte, c.Size)
l := 8 // always use small starting buffer
if c.Size > l {
l = c.Size
}
c.Buffer = make([]byte, l)
return c
}

Expand Down

0 comments on commit 91d3dd4

Please sign in to comment.