summaryrefslogtreecommitdiff
path: root/pango/break-thai.c
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-11-14 14:39:10 +0800
committerPeng Wu <alexepico@gmail.com>2018-11-14 14:39:10 +0800
commitcd943d8b880e702a90575be363b79f09144e75cb (patch)
treefb9572ea64ad86788618a61b09147d9e00342ad6 /pango/break-thai.c
parent089c9936472f163ca52d3605d09b1b3ccdfa3d14 (diff)
downloadpango-cd943d8b880e702a90575be363b79f09144e75cb.tar.gz
Use the shared brk in break-thai.c
Use the shared brk to improve the performance of the break_thai function.
Diffstat (limited to 'pango/break-thai.c')
-rw-r--r--pango/break-thai.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/pango/break-thai.c b/pango/break-thai.c
index 2ab24bd0..85b9e54a 100644
--- a/pango/break-thai.c
+++ b/pango/break-thai.c
@@ -64,9 +64,6 @@ break_thai (const char *text,
thchar_t *tis_text;
int *brk_pnts;
int cnt;
-#ifdef HAVE_TH_BRK_FIND_BREAKS
- ThBrk* brk;
-#endif
cnt = pango_utf8_strlen (text, len) + 1;
@@ -83,18 +80,13 @@ break_thai (const char *text,
/* find line break positions */
#ifdef HAVE_TH_BRK_FIND_BREAKS
- brk = th_brk_new(NULL);
- len = th_brk_find_breaks(brk, tis_text, brk_pnts, cnt);
- if (brk)
- th_brk_delete(brk);
- else
- g_warning ("%s: failed to load the default Thai word-breaker.",
- G_STRLOC);
+ len = th_brk_find_breaks(NULL, tis_text, brk_pnts, cnt);
#else
G_LOCK (th_brk);
len = th_brk (tis_text, brk_pnts, cnt);
G_UNLOCK (th_brk);
#endif
+
for (cnt = 0; cnt < len; cnt++)
if (attrs[brk_pnts[cnt]].is_char_break)
{