summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
diff options
context:
space:
mode:
authorJihoon Kim <imfine98@gmail.com>2012-02-13 10:55:26 +0000
committerJihoon Kim <imfine98@gmail.com>2012-02-13 10:55:26 +0000
commit427e4ebce060c5da6336f149e766e51bae0de59d (patch)
tree152da628b84196d956d7d5421da34baa05fe5b96 /legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
parent1a29f7f309cdd6a88bc7d32aa1877f52ae46bc73 (diff)
scim_immodule: improve maintenability
SVN revision: 67878
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
index 6d81c39b00..05012f851b 100644
--- a/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
+++ b/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
@@ -363,13 +363,14 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
363{ 363{
364 char *plain_str = NULL; 364 char *plain_str = NULL;
365 char *markup_str = NULL; 365 char *markup_str = NULL;
366 const char *puncs[3] = {". ", "! ", "? "}; 366 const char *puncs[] = {". ", "! ", "? "};
367 Eina_Bool ret = EINA_FALSE; 367 Eina_Bool ret = EINA_FALSE;
368 int cursor_pos = 0; 368 int cursor_pos = 0;
369 int i = 0; 369 int i = 0;
370 Eina_Unicode *tail = NULL; 370 Eina_Unicode *tail = NULL;
371 Eina_Unicode *ustr = NULL; 371 Eina_Unicode *ustr = NULL;
372 Eina_Unicode *uni_puncs[3]; 372 const int punc_num = sizeof(puncs) / sizeof(puncs[0]);
373 Eina_Unicode *uni_puncs[punc_num];
373 EcoreIMFContextISF *context_scim; 374 EcoreIMFContextISF *context_scim;
374 375
375 if (!ctx) return EINA_FALSE; 376 if (!ctx) return EINA_FALSE;
@@ -386,7 +387,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
386 break; 387 break;
387 } 388 }
388 389
389 for (i = 0; i < 3; i++) 390 for (i = 0; i < punc_num; i++)
390 uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL); 391 uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL);
391 392
392 ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos); 393 ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos);
@@ -432,7 +433,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
432 433
433 if (tail) 434 if (tail)
434 { 435 {
435 for (i = 0; i < 3; i++) 436 for (i = 0; i < punc_num; i++)
436 { 437 {
437 if (!eina_unicode_strcmp(tail, uni_puncs[i])) 438 if (!eina_unicode_strcmp(tail, uni_puncs[i]))
438 { 439 {
@@ -450,7 +451,7 @@ done:
450 if (markup_str) free(markup_str); 451 if (markup_str) free(markup_str);
451 if (plain_str) free(plain_str); 452 if (plain_str) free(plain_str);
452 453
453 for (i = 0; i < 3; i++) 454 for (i = 0; i < punc_num; i++)
454 if (uni_puncs[i]) free(uni_puncs[i]); 455 if (uni_puncs[i]) free(uni_puncs[i]);
455 456
456 return ret; 457 return ret;