-JSObjectRef CYMakeCArray(JSContextRef context, void *data, size_t length, const sig::Type &type, ffi_type *ffi, JSObjectRef owner) {
- CArray *internal(new CArray(data, context, owner, length, type, ffi));
-
- if (owner == NULL) {
- size_t size(ffi->size * length);
- void *copy(internal->pool_->malloc<void>(size, ffi->alignment));
- memcpy(copy, internal->value_, size);
- internal->value_ = copy;
- }
-
- return JSObjectMake(context, CArray_, internal);
-}
-
-JSObjectRef CYMakeCString(JSContextRef context, char *pointer, JSObjectRef owner) {
- CString *internal(new CString(pointer, context, owner));
- if (owner == NULL)
- internal->value_ = internal->pool_->strdup(static_cast<const char *>(internal->value_));
- return JSObjectMake(context, CString_, internal);
-}
-
-JSObjectRef CYMakeStruct(JSContextRef context, void *data, const sig::Type &type, ffi_type *ffi, JSObjectRef owner) {
- Struct_privateData *internal(new Struct_privateData(data, context, owner, type, ffi));
-
- if (owner == NULL) {
- size_t size(ffi->size);
- void *copy(internal->pool_->malloc<void>(size, ffi->alignment));
- memcpy(copy, internal->value_, size);
- internal->value_ = copy;
- }
-
- return JSObjectMake(context, Struct_, internal);
-}
-