1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-04-22 07:07:51 +02:00

Fix build on go < 1.7

This commit is contained in:
DarthSim 2017-09-27 23:22:13 +06:00
parent 5d4e3c7f9f
commit c85534110f
3 changed files with 17 additions and 1 deletions

9
keepalive.go Normal file

@ -0,0 +1,9 @@
// +build go1.7
package main
import "runtime"
func keepAlive(i interface{}) {
runtime.KeepAlive(i)
}

7
keepalive_old.go Normal file

@ -0,0 +1,7 @@
// +build !go1.7
package main
func keepAlive(i interface{}) {
// Dummy function. Do nothing
}

@ -160,7 +160,7 @@ func calcCrop(width, height int, po processingOptions) (left, top int) {
} }
func processImage(data []byte, imgtype imageType, po processingOptions) ([]byte, error) { func processImage(data []byte, imgtype imageType, po processingOptions) ([]byte, error) {
defer runtime.KeepAlive(data) defer keepAlive(data)
err := C.int(0) err := C.int(0)