diff options
Diffstat (limited to 'include/stc/carr2.h')
| -rw-r--r-- | include/stc/carr2.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/stc/carr2.h b/include/stc/carr2.h index d1feb90b..92964d4d 100644 --- a/include/stc/carr2.h +++ b/include/stc/carr2.h @@ -34,7 +34,7 @@ int main() { int w = 7, h = 5; - c_autovar (carr2_int image = carr2_int_init(w, h), carr2_int_del(&image)) + c_autovar (carr2_int image = carr2_int_init(w, h), carr2_int_drop(&image)) { int *dat = carr2_int_data(&image); for (int i = 0; i < carr2_int_size(image); ++i) @@ -63,7 +63,7 @@ _cx_deftypes(_c_carr2_types, _cx_self, i_val); STC_API _cx_self _cx_memb(_with_values)(size_t xdim, size_t ydim, i_val value); STC_API _cx_self _cx_memb(_with_storage)(size_t xdim, size_t ydim, _cx_value* storage); STC_API _cx_value* _cx_memb(_release)(_cx_self* self); -STC_API void _cx_memb(_del)(_cx_self* self); +STC_API void _cx_memb(_drop)(_cx_self* self); #if !c_option(c_no_clone) STC_API _cx_self _cx_memb(_clone)(_cx_self src); STC_API void _cx_memb(_copy)(_cx_self *self, _cx_self other); @@ -124,7 +124,7 @@ STC_DEF _cx_self _cx_memb(_clone)(_cx_self src) { STC_DEF void _cx_memb(_copy)(_cx_self *self, _cx_self other) { if (self->data == other.data) return; - _cx_memb(_del)(self); *self = _cx_memb(_clone)(other); + _cx_memb(_drop)(self); *self = _cx_memb(_clone)(other); } #endif @@ -135,10 +135,11 @@ STC_DEF _cx_value *_cx_memb(_release)(_cx_self* self) { return values; } -STC_DEF void _cx_memb(_del)(_cx_self* self) { +STC_DEF void _cx_memb(_drop)(_cx_self* self) { if (!self->data) return; - for (_cx_value* p = self->data[0], *e = p + _cx_memb(_size)(*self); p != e; ++p) - i_valdel(p); + for (_cx_value* p = self->data[0], *q = p + _cx_memb(_size)(*self); p != q; ) { + --q; i_valdrop(q); + } c_free(self->data[0]); /* values */ c_free(self->data); /* pointers */ } |
