aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/go-gl/glfw/v3.3/glfw/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-gl/glfw/v3.3/glfw/util.go')
-rw-r--r--vendor/github.com/go-gl/glfw/v3.3/glfw/util.go19
1 files changed, 2 insertions, 17 deletions
diff --git a/vendor/github.com/go-gl/glfw/v3.3/glfw/util.go b/vendor/github.com/go-gl/glfw/v3.3/glfw/util.go
index 0d0a2c9..2bf56ed 100644
--- a/vendor/github.com/go-gl/glfw/v3.3/glfw/util.go
+++ b/vendor/github.com/go-gl/glfw/v3.3/glfw/util.go
@@ -5,11 +5,6 @@ package glfw
//#include "glfw/include/GLFW/glfw3.h"
import "C"
-import (
- "reflect"
- "unsafe"
-)
-
func glfwbool(b C.int) bool {
if b == C.int(True) {
return true
@@ -19,20 +14,10 @@ func glfwbool(b C.int) bool {
func bytes(origin []byte) (pointer *uint8, free func()) {
n := len(origin)
-
if n == 0 {
return nil, func() {}
}
- data := C.malloc(C.size_t(n))
-
- dataSlice := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{
- Data: uintptr(data),
- Len: n,
- Cap: n,
- }))
-
- copy(dataSlice, origin)
-
- return &dataSlice[0], func() { C.free(data) }
+ ptr := C.CBytes(origin)
+ return (*uint8)(ptr), func() { C.free(ptr) }
}