Avoid reallocations with variadic arguments.

Thanks to huon for pointing that out.
This commit is contained in:
Ms2ger 2014-06-09 14:06:03 +02:00
parent 78f368d336
commit 406acd17af

View file

@ -941,7 +941,7 @@ class CGArgumentConverter(CGThing):
seqType = CGTemplatedType("Vec", declType)
variadicConversion = string.Template(
"{\n"
" let mut vector: ${seqType} = vec![];\n"
" let mut vector: ${seqType} = Vec::with_capacity((${argc} - ${index}) as uint);\n"
" for variadicArg in range(${index}, ${argc}) {\n"
"${inner}\n"
" vector.push(slot);\n"