summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny <3454741+WarriorOfWire@users.noreply.github.com>2020-07-20 10:12:29 -0700
committerKenny <3454741+WarriorOfWire@users.noreply.github.com>2020-07-20 10:12:29 -0700
commite2d252a6d5f4b2425215e0a79f78b8cbfa657f9a (patch)
treec9dd8364bad5a1cf9f79a7ac0e6a48da3789b155
parentefeae0d84fa1745595d26e66590c1944269b6aae (diff)
pre-allocate list of known size
-rw-r--r--shared-module/vectorio/Polygon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shared-module/vectorio/Polygon.c b/shared-module/vectorio/Polygon.c
index aeeaf0224..c44c13fd7 100644
--- a/shared-module/vectorio/Polygon.c
+++ b/shared-module/vectorio/Polygon.c
@@ -69,7 +69,7 @@ void common_hal_vectorio_polygon_construct(vectorio_polygon_t *self, mp_obj_t po
mp_obj_t common_hal_vectorio_polygon_get_points(vectorio_polygon_t *self) {
VECTORIO_POLYGON_DEBUG("%p common_hal_vectorio_polygon_get_points {len: %d, points_list: %p}\n", self, self->len, self->points_list);
- mp_obj_t list = mp_obj_new_list(0, NULL);
+ mp_obj_t list = mp_obj_new_list(self->len/2, NULL);
for (size_t i = 0; i < self->len; i += 2) {
mp_obj_t tuple[] = { mp_obj_new_int(self->points_list[i]), mp_obj_new_int(self->points_list[i+1]) };