|
|
@ -1226,8 +1226,8 @@ int ink_new_type( |
|
|
|
struct context* ctx, |
|
|
|
const char* type_name, |
|
|
|
int size, |
|
|
|
kt">void (*collect)(struct context*,void*), |
|
|
|
k">struct ink_collection_list (*gc)(struct context*,void*) |
|
|
|
n">collect_fn collect, |
|
|
|
n">gc_fn gc |
|
|
|
) { |
|
|
|
if(ctx->panic) return -128; |
|
|
|
/* Resize for push */ |
|
|
@ -1332,9 +1332,6 @@ struct elem ink_make_native_unsafe(struct context* ctx, int type, void* ptr, int |
|
|
|
g = ctx->types[type_id].elements_capacity; |
|
|
|
for(i = 0; i < g; ++i) { |
|
|
|
if(! ctx->types[type_id].elements[i].in_use) { |
|
|
|
ctx->types[type_id].elements[i].in_use = 1; |
|
|
|
ctx->types[type_id].elements[i].uses = 1; |
|
|
|
ctx->types[type_id].elements[i].is_protected = is_protected; |
|
|
|
if(ctx->types[type_id].element_size < 0) { |
|
|
|
ctx->types[type_id].elements[i].data = ptr; |
|
|
|
} else { |
|
|
@ -1346,6 +1343,9 @@ struct elem ink_make_native_unsafe(struct context* ctx, int type, void* ptr, int |
|
|
|
} |
|
|
|
memcpy(new_ptr, ptr, ctx->types[type_id].element_size); |
|
|
|
ctx->types[type_id].elements[i].data = new_ptr; |
|
|
|
ctx->types[type_id].elements[i].is_protected = is_protected; |
|
|
|
ctx->types[type_id].elements[i].uses = 1; |
|
|
|
ctx->types[type_id].elements[i].in_use = 1; |
|
|
|
} |
|
|
|
ctx->types[type_id].elements_top = max(ctx->types[type_id].elements_top, i+1); |
|
|
|
ret.type = type; |
|
|
|