From 834f789a3d9cdffe0e1fa9ec8e4c2b9f85b69d01 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 17 Jul 2017 17:06:29 +0900 Subject: [PATCH] Improve code performance when sending forward key event Code like this is a typical side effect of the refactoring of old C code turned into C++. The length of a string in a variable of type std::string is computed by the strlen function. This method is obviously inefficient and cumbersome. Change-Id: Ibf17a043b96b134eb8f9b671d2d0d5d64534ebe1 Signed-off-by: Jihoon Kim --- ism/extras/efl_immodule/isf_imf_context.cpp | 2 +- ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ism/extras/efl_immodule/isf_imf_context.cpp b/ism/extras/efl_immodule/isf_imf_context.cpp index 9b8142b..4bf13d5 100644 --- a/ism/extras/efl_immodule/isf_imf_context.cpp +++ b/ism/extras/efl_immodule/isf_imf_context.cpp @@ -2247,7 +2247,7 @@ panel_slot_forward_key_event (int context, const KeyEvent &key) return; } - if (strlen (key.get_key_string ().c_str ()) >= 116) { + if (key.get_key_string ().length () >= 116) { LOGW ("the length of key string is too long\n"); return; } diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index d70e447..241d654 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -2569,7 +2569,7 @@ panel_slot_forward_key_event (int context, const KeyEvent &key, bool remote_mode check_input_resource (ic, INPUT_RESOURCE_LOCAL); } - if (strlen (key.get_key_string ().c_str ()) >= 116) + if (key.get_key_string ().length () >= 116) return; send_wl_key_event (ic, key, true); -- 2.7.4