ext/numo/narray/gen/tmpl/cast_array.c in numo-narray-0.9.0.4 vs ext/numo/narray/gen/tmpl/cast_array.c in numo-narray-0.9.0.5
- old
+ new
@@ -1,18 +1,13 @@
static VALUE
-<%=c_func%>(VALUE rary)
+<%=c_func(:nodef)%>(VALUE rary)
{
- VALUE vnc, nary;
+ VALUE nary;
narray_t *na;
- na_compose_t *nc;
- vnc = na_ary_composition(rary);
- Data_Get_Struct(vnc, na_compose_t, nc);
- nary = rb_narray_new(cT, nc->ndim, nc->shape);
- RB_GC_GUARD(vnc);
+ nary = na_s_new_like(cT, rary);
GetNArray(nary,na);
if (na->size > 0) {
- <%=find_tmpl("allocate").c_func%>(nary);
- <%=find_tmpl("store_array").c_func%>(nary,rary);
+ <%=find_tmpl("store").find("array").c_func%>(nary,rary);
}
return nary;
}