reserve space for vector of can_frame (#20771)

old-commit-hash: e151425c1c7f3e642b06504c165d7db8bab8a603
This commit is contained in:
Dean Lee
2021-04-29 04:50:21 +08:00
committed by GitHub
parent 9aa9d33f92
commit d76b938a03
+2
View File
@@ -14,6 +14,8 @@ cdef extern void can_list_to_can_capnp_cpp(const vector[can_frame] &can_list, st
def can_list_to_can_capnp(can_msgs, msgtype='can', valid=True):
cdef vector[can_frame] can_list
can_list.reserve(len(can_msgs))
cdef can_frame f
for can_msg in can_msgs:
f.address = can_msg[0]