diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-06-04 16:16:03 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2014-06-04 16:16:03 -0400 |
commit | 16ac456e590e11bc2028a697c586a6c7d00fc41a (patch) | |
tree | b961eca096657b5eec2a949e04b1f3fac34dab82 /libdimension-python/dimension.pyx | |
parent | 270a53ef8d4d009dd79605058b780dc6d1f2ed1a (diff) | |
download | dimension-16ac456e590e11bc2028a697c586a6c7d00fc41a.tar.xz |
csg: Avoid copying the child array for unions.
Diffstat (limited to 'libdimension-python/dimension.pyx')
-rw-r--r-- | libdimension-python/dimension.pyx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx index d3f880c..0c4d665 100644 --- a/libdimension-python/dimension.pyx +++ b/libdimension-python/dimension.pyx @@ -1283,17 +1283,14 @@ cdef class Union(Object): if len(objects) < 1: raise TypeError("expected a list of one or more Objects") - cdef dmnsn_array *array = dmnsn_new_array(sizeof(dmnsn_object *)) + cdef dmnsn_array *array = dmnsn_palloc_array(_get_pool(), sizeof(dmnsn_object *)) cdef dmnsn_object *o - try: - for obj in objects: - o = (<Object?>obj)._object - dmnsn_array_push(array, &o) + for obj in objects: + o = (<Object?>obj)._object + dmnsn_array_push(array, &o) - self._object = dmnsn_new_csg_union(_get_pool(), array) - finally: - dmnsn_delete_array(array) + self._object = dmnsn_new_csg_union(_get_pool(), array) Object.__init__(self, *args, **kwargs) |