aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp
diff options
context:
space:
mode:
authorRobert Varga <robert.varga@pantheon.tech>2017-05-25 19:03:18 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-05-26 18:14:20 +0000
commited1e242866704d1f8654e44ed32c4b431d2d5795 (patch)
treee98ae927f2d2b42f9f4e369fefddff1a75aa5bc6 /src/vpp-api/java/jvpp
parent612a383e7f6cb9a6b846674a09a19299ed31a138 (diff)
Improve jvppgen object array member instantiation
Since all objects of the array have the same type, the object constructor is a loop invariant. Move the lookup out of the loop, making things faster. Change-Id: I631c72b59c6c63eccd49ede41c6dc0541c325db9 Signed-off-by: Robert Varga <robert.varga@pantheon.tech> Signed-off-by: Robert Varga <nite@hq.sk>
Diffstat (limited to 'src/vpp-api/java/jvpp')
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
index 22018e67009..858ea8baae7 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
@@ -91,9 +91,9 @@ object_array_dto_field_setter_template = Template("""
{
jclass ${field_reference_name}Class = (*env)->FindClass(env, "${class_FQN}");
jobjectArray ${field_reference_name} = (*env)->NewObjectArray(env, ${field_length}, ${field_reference_name}Class, 0);
+ jmethodID ${field_reference_name}Constructor = (*env)->GetMethodID(env, ${field_reference_name}Class, "<init>", "()V");
unsigned int _i;
for (_i = 0; _i < ${field_length}; _i++) {
- jmethodID ${field_reference_name}Constructor = (*env)->GetMethodID(env, ${field_reference_name}Class, "<init>", "()V");
jobject ${field_reference_name}ArrayElement = (*env)->NewObject(env, ${field_reference_name}Class, ${field_reference_name}Constructor);
${type_initialization}
(*env)->SetObjectArrayElement(env, ${field_reference_name}, _i, ${field_reference_name}ArrayElement);