Created
June 29, 2011 02:40
-
-
Save crazy2be/1052853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given a slice of go-style Values, this function allocates a new array of c-style values and returns a pointer to the first element in the array, along with the length of the array. | |
func (ctx *Context) newCValueArray(val []*Value) (*C.JSValueRef, C.size_t) { | |
if len(val) == 0 { | |
return nil, 0 | |
} | |
arr := make([]C.JSValueRef, len(val)) | |
for i := 0; i < len(val); i++ { | |
arr[i] = val[i].ref | |
} | |
return &arr[0], C.size_t(len(arr)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment