Hello community, here is the log from the commit of package libthai for openSUSE:Factory checked in at 2015-11-18 22:30:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libthai (Old) and /work/SRC/openSUSE:Factory/.libthai.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libthai" Changes: -------- --- /work/SRC/openSUSE:Factory/libthai/libthai.changes 2015-05-16 07:13:48.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libthai.new/libthai.changes 2015-11-18 22:30:56.000000000 +0100 @@ -1,0 +2,9 @@ +Thu Nov 12 23:22:47 UTC 2015 - [email protected] + +- Update to version 0.1.23: + + Correctly check doxygen version on configure. + + Threadsafe word breaking. + + Improve word breaking performance by 0.1%. + + Updated word break dictionary. + +------------------------------------------------------------------- Old: ---- libthai-0.1.22.tar.xz New: ---- libthai-0.1.23.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libthai.spec ++++++ --- /var/tmp/diff_new_pack.ha12nK/_old 2015-11-18 22:30:58.000000000 +0100 +++ /var/tmp/diff_new_pack.ha12nK/_new 2015-11-18 22:30:58.000000000 +0100 @@ -17,7 +17,7 @@ Name: libthai -Version: 0.1.22 +Version: 0.1.23 Release: 0 Summary: Thai Language Support Routines License: LGPL-2.1+ ++++++ libthai-0.1.22.tar.xz -> libthai-0.1.23.tar.xz ++++++ ++++ 4007 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/ChangeLog new/libthai-0.1.23/ChangeLog --- old/libthai-0.1.22/ChangeLog 2015-05-08 06:53:21.000000000 +0200 +++ new/libthai-0.1.23/ChangeLog 2015-10-22 09:39:13.000000000 +0200 @@ -1,3 +1,162 @@ +2015-10-22 Theppitak Karoonboonyanan <[email protected]> + + * configure.ac: + - Bump library revision to reflect code changes. + + * configure.ac, NEWS: + === Version 0.1.23 === + +2015-10-21 Theppitak Karoonboonyanan <[email protected]> + + Update word break dictionary. + + * data/tdict-city.txt: + * data/tdict-common.txt: + * data/tdict-country.txt: + * data/tdict-ict.txt: + * data/tdict-lang-ethnic.txt: + * data/tdict-proper.txt: + * data/tdict-science.txt: + * data/tdict-spell.txt: Add words. + +2015-10-16 Theppitak Karoonboonyanan <[email protected]> + + Share BrkEnv longer. + + The code before the threadsafe commit used to initialize the + free list earlier in th_brk() and then called brk_maximal_do() + multiple times. This allowed the free list to be shared among + all such calls. The threadsafe commit did it deep in + brk_maximal_do_impl(), limiting the share within the single + brk_maximal_do() call only. We should widen the use to be + the same as previously done. + + * src/thbrk/brk-maximal.h (+brk_env_new, +brk_env_free): + - Re-add initialization/quit functions in terms of BrkEnv. + - Add BrkEnv* arg to brk_maximal_do(). + * src/thbrk/brk-maximal.c (brk_env_init -> brk_env_new, + brk_env_destroy -> brk_env_free): + - Turn the init/destroy functions into new/free version. + * src/thbrk/brk-maximal.c (brk_maximal_do, brk_maximal_do_impl): + - Add the BrkEnv* arg and use it instead of the locally created + one. + * src/thbrk/thbrk.c (th_brk): + - Create BrkEnv object at start and free it at end. + - Add the env arg to brk_maximal_do() calls. + + This appears to save more 2.4% of the total runtime and makes + it on par with the code before the threadsafe commit again. + +2015-10-14 Theppitak Karoonboonyanan <[email protected]> + + Call brk_pool_match() linearly. + + * src/thbrk/brk-maximal.c (brk_maximal_do_impl, brk_recover_try): + - Start next brk_pool_match() on node next to previously matched + one, instead of the pool head, making the match O(n) instead of + O(n^2). + - [brk_maximal_do_impl] Also prevent using the deleted node to + start the next round. + - [brk_recover_try] Also start brk_pool_delete_node() on the + pool tail, making it also linear. This is not possible for + brk_maximal_do_impl, as the node to be deleted is not fixed. + + This appears to save time by 8.85% on brk_pool_match() calls, + lowering its bottleneck rank by 2 positions, and saves time by + 0.0388% of total run time. + +2015-10-14 Theppitak Karoonboonyanan <[email protected]> + + Declare variable inside block. + + * src/thbrk/brk-maximal.c (brk_maximal_do_impl, brk_recover_try): + - Move "BrkPool *match" declaration into the block it's used. + +2015-10-12 Theppitak Karoonboonyanan <[email protected]> + + Declare const arg for brk_pool_match(). + + * src/thbrk/brk-maximal.c (brk_pool_match): + - Add const-ness to the read-only 'node' arg. + +2015-10-11 Theppitak Karoonboonyanan <[email protected]> + + Minor optimization on brk_pool_match(). + + Callgrind reports brk_pool_match() among top bottlenecks. + So, try to optimize it as we can. + + * src/thbrk/brk-maximal.c (brk_pool_match): + - Instead of sharing the loop for two different cases, + check the case once and run loop for each case separately, + to minimize branching down to a single time. + - Evaluate the unchanged 'node->shot.brk_pos[node_cur_pos - 1]' + expression only once, instead of on every round. + + This appears to save time by 9.3% for total brk_pool_match() calls, + and by 0.067% of total run time. + +2015-10-11 Theppitak Karoonboonyanan <[email protected]> + + Fix 'make check' error on long path names. + + * tests/thsort.c (main): + - Increase file name buffers from 64 to 512, to afford long path + names in command-line arguments. + +2015-10-10 Theppitak Karoonboonyanan <[email protected]> + + Replace static global free-list with local one. + + The static global free-list in brk-maximal.c makes it not + thread-safe. + + * src/thbrk/brk-maximal.c: + - Add type BrkEnv to keep break pool free list, with + brk_env_init() and brk_env_destroy() methods. + - (brk_pool_node_new, brk_pool_node_free, brk_pool_free, + brk_pool_delete, brk_root_pool, brk_recover_try, + brk_recover): + Add (BrkEnv *) arg to relevant functions and use it properly. + - (brk_maximal_do): + Create and destroy BrkEnv instance for use locally. + Pass it to the required function calls. + - (brk_pool_delete -> brk_pool_delete_node): + Rename function to avoid confusion with brk_pool_free(). + + * src/thbrk/brk-maximal.c: + * src/thbrk/brk-maximal.h: + * src/thbrk/thbrk.c: + - Get rid of now-unnecessary brk_maximal_init() and + brk_maximal_quit(). + + Thanks Behdad Esfahbod for the report. + +2015-09-07 Theppitak Karoonboonyanan <[email protected]> + + Fix doxygen version checking. + + * configure.ac: + - Correctly compare doxygen versions. Simple expr comparison + didn't work with version 1.8.10. + + Taken from Petr Gajdos <[email protected]>'s patch for libdatrie. + +2015-06-04 Theppitak Karoonboonyanan <[email protected]> + + Protect against invalid array access. + + * src/thbrk/thbrk.c (th_brk): + - Add a condition to protect against accessing pos[-1] + which may be caused by a failure in brk_maximal_do() + on the first Thai chunk, which makes cur_pos remain 0. + + Thanks Behdad Esfahbod for the report. + +2015-06-04 Theppitak Karoonboonyanan <[email protected]> + + * configure.ac: Post-release version suffix added. + 2015-05-08 Theppitak Karoonboonyanan <[email protected]> * configure.ac, NEWS: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/NEWS new/libthai-0.1.23/NEWS --- old/libthai-0.1.22/NEWS 2015-05-08 06:40:28.000000000 +0200 +++ new/libthai-0.1.23/NEWS 2015-10-22 06:45:33.000000000 +0200 @@ -2,6 +2,15 @@ RELEASES INFORMATION ======================================================================= +LibThai 0.1.23 (22 Oct 2015): +* Correctly check doxygen version on configure. + (Change adapted from Petr Gajdos' proposed patch to libdatrie.) +* Threadsafe word breaking. + (Thanks Behdad Esfahbod for the report.) +* Improve word breaking performance by 0.1% + (About 0.28% when used with libdatrie 0.2.10) +* Updated word break dictionary. + LibThai 0.1.22 (8 May 2015): * Updated word break dictionary. * Improve word breaking performance by 0.38% diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/compile new/libthai-0.1.23/compile --- old/libthai-0.1.22/compile 2014-10-27 05:45:43.000000000 +0100 +++ new/libthai-0.1.23/compile 2015-08-15 12:37:35.000000000 +0200 @@ -3,7 +3,7 @@ scriptversion=2012-10-14.11; # UTC -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey <[email protected]>. # # This program is free software; you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/configure.ac new/libthai-0.1.23/configure.ac --- old/libthai-0.1.22/configure.ac 2015-05-08 06:53:06.000000000 +0200 +++ new/libthai-0.1.23/configure.ac 2015-10-22 06:24:12.000000000 +0200 @@ -2,7 +2,7 @@ AC_PREREQ(2.50) -AC_INIT(libthai, 0.1.22, [email protected]) +AC_INIT(libthai, 0.1.23, [email protected]) AC_CONFIG_SRCDIR([include/thai/thailib.h]) AC_CONFIG_MACRO_DIR([m4]) @@ -13,7 +13,7 @@ # Interfaces added: CURRENT++ REVISION=0 AGE++ # Interfaces changed/removed: CURRENT++ REVISION=0 AGE=0 LT_CURRENT=2 -LT_REVISION=2 +LT_REVISION=3 LT_AGE=2 AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) @@ -89,12 +89,9 @@ else AC_MSG_CHECKING([doxygen >= $DOXYGEN_REQ_VER]) DOXYGEN_VER=$($DOXYGEN --version) - if expr $DOXYGEN_VER \< $DOXYGEN_REQ_VER > /dev/null; then - AC_MSG_RESULT([$DOXYGEN_VER, no, documentation disabled]) - enable_doxygen_doc="no" - else - AC_MSG_RESULT([$DOXYGEN_VER, yes]) - fi + AX_COMPARE_VERSION([$DOXYGEN_VER],[ge],[DOXYGEN_REQ_VER], + [AC_MSG_RESULT([$DOXYGEN_VER, yes])], + [AC_MSG_RESULT([$DOXYGEN_VER, no, documentation disabled]); enable_doxygen_doc="no"]) fi fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-city.txt new/libthai-0.1.23/data/tdict-city.txt --- old/libthai-0.1.22/data/tdict-city.txt 2015-02-04 15:58:28.000000000 +0100 +++ new/libthai-0.1.23/data/tdict-city.txt 2015-10-21 10:58:14.000000000 +0200 @@ -223,6 +223,7 @@ อชันตา อลาสกา อวันตี +ออตตาวา ออริกอน ออสโล อะแลสกา diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-common.txt new/libthai-0.1.23/data/tdict-common.txt --- old/libthai-0.1.22/data/tdict-common.txt 2015-05-06 11:33:45.000000000 +0200 +++ new/libthai-0.1.23/data/tdict-common.txt 2015-10-21 10:58:14.000000000 +0200 @@ -93,6 +93,8 @@ คอมมูน คอมเมนท์ คอมเมนต์ +คอร์ต +คอร์ท คอร์ป คอร์ปอเรชั่น คอร์รัปชัน @@ -272,6 +274,7 @@ ซามูไร ซาร์ ซาร์ดีน +ซาร์ส ซาลามานเดอร์ ซาลาแมนเดอร์ ซาเล้ง @@ -323,6 +326,7 @@ เซเลบ เซเล็บ เซอร์ +เซอร์กิต เซอร์ไพรส์ เซอร์วิส เซาท์ @@ -694,6 +698,7 @@ พลานุภาพ พ่อค้า พอเพียง +พอยต์ พอยท์ พะเรอ พันธกิจ @@ -844,6 +849,7 @@ มาร์ท มาราธอน ม้าหินอ่อน +มิชชันนารี มินต์ มินท์ มินิ @@ -863,6 +869,7 @@ เมทัล เมโทร เมเปิล +เมอร์ส เมาท์ เมี่ยงคำ แมกกาซีน @@ -925,6 +932,7 @@ รัม รากหญ้า ราชบัณฑิตยสถาน +ราชบัณฑิตยสภา ราชานุญาต ราชานุสาวรีย์ รามเทพ @@ -1179,6 +1187,7 @@ สับปะรังเค สัปปะรังเค สัมนา +สาธารณกุศล สามช่า สามแยก สารขัน @@ -1212,6 +1221,8 @@ หล่อฮังก้วย หลินจือ ห่วย +หะเบส +หะเรีย หิญาบ เห็นด้วย เหมย diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-country.txt new/libthai-0.1.23/data/tdict-country.txt --- old/libthai-0.1.22/data/tdict-country.txt 2015-02-04 15:58:28.000000000 +0100 +++ new/libthai-0.1.23/data/tdict-country.txt 2015-10-21 10:58:14.000000000 +0200 @@ -136,6 +136,7 @@ มาลี มาเลเซีย เม็กซิโก +เมียนมา เมียนมาร์ โมซัมบิก โมนาโก diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-ict.txt new/libthai-0.1.23/data/tdict-ict.txt --- old/libthai-0.1.22/data/tdict-ict.txt 2015-05-06 11:33:45.000000000 +0200 +++ new/libthai-0.1.23/data/tdict-ict.txt 2015-10-21 10:58:14.000000000 +0200 @@ -15,6 +15,7 @@ คลิปอาร์ต คอนโซล คอนเทนต์ +คอนเทนท์ คอนฟิก คอมพิวติ้ง คอมไพล์ @@ -67,6 +68,7 @@ ทวิตเตอร์ ทวีต ทัชแพด +ทัชสกรีน เทมเพลต เทอร์มินัล แท็ก diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-lang-ethnic.txt new/libthai-0.1.23/data/tdict-lang-ethnic.txt --- old/libthai-0.1.22/data/tdict-lang-ethnic.txt 2015-02-04 15:58:28.000000000 +0100 +++ new/libthai-0.1.23/data/tdict-lang-ethnic.txt 2015-10-21 10:58:14.000000000 +0200 @@ -7,6 +7,7 @@ คาตาคานะ คุชราตี คุรุมุขี +เคิร์ด ซีริลลิก ซูลู เซลติก @@ -30,6 +31,7 @@ รัสเซียน โรฮิงญา โรฮิงยา +โรฮีนจา สวาฮิลี สวิส สินธี diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-proper.txt new/libthai-0.1.23/data/tdict-proper.txt --- old/libthai-0.1.22/data/tdict-proper.txt 2015-05-06 11:33:45.000000000 +0200 +++ new/libthai-0.1.23/data/tdict-proper.txt 2015-10-21 10:58:14.000000000 +0200 @@ -295,6 +295,7 @@ ยโสธรา ยะโฮวา ยะโฮวาห์ +ยาคูลท์ ยามาฮ่า ยาเวห์ ยาฮู @@ -426,6 +427,7 @@ ออยเลอร์ ออร์คิด ออสการ์ +อะแซหวุ่นกี้ อะธีนา อะพอลโล อับราฮัม diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-science.txt new/libthai-0.1.23/data/tdict-science.txt --- old/libthai-0.1.22/data/tdict-science.txt 2015-05-06 11:33:45.000000000 +0200 +++ new/libthai-0.1.23/data/tdict-science.txt 2015-10-21 10:58:14.000000000 +0200 @@ -1,6 +1,10 @@ กลีเซอรีน กลีเซอไรด์ กัมมันต์ +กาแลกโตส +กาแล็กโตส +กาแลกโทส +กาแล็กโทส กำทอน แกนีมีด ครอส @@ -128,6 +132,7 @@ ฟิวชัน ฟีโรโมน เฟอร์มิออน +โฟตอน ไฟเบอร์ มอนอกไซด์ มิราจ @@ -150,6 +155,10 @@ รูมาตอยด์ ไรโบโซม เลปตอน +แลกโตส +แล็กโตส +แลกโทส +แล็กโทส ไลโซโซม วีก้า เวกเตอร์ @@ -228,4 +237,5 @@ ไฮดรอกไซด์ ไฮดรอลิก ไฮโดรลิก +ไฮไดรด์ ไฮเพอร์โบลา diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/data/tdict-spell.txt new/libthai-0.1.23/data/tdict-spell.txt --- old/libthai-0.1.22/data/tdict-spell.txt 2015-05-02 13:04:19.000000000 +0200 +++ new/libthai-0.1.23/data/tdict-spell.txt 2015-10-21 10:58:14.000000000 +0200 @@ -41,6 +41,7 @@ เบรค แบงค์ ปรากฎ +ปอเปี๊ยะ ปัคคหะ ปาฏิโมกข์ ปิคนิค diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/missing new/libthai-0.1.23/missing --- old/libthai-0.1.22/missing 2014-10-27 05:45:43.000000000 +0100 +++ new/libthai-0.1.23/missing 2015-08-15 12:37:35.000000000 +0200 @@ -3,7 +3,7 @@ scriptversion=2013-10-28.13; # UTC -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <[email protected]>, 1996. # This program is free software; you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/src/thbrk/brk-maximal.c new/libthai-0.1.23/src/thbrk/brk-maximal.c --- old/libthai-0.1.22/src/thbrk/brk-maximal.c 2015-05-06 10:13:19.000000000 +0200 +++ new/libthai-0.1.23/src/thbrk/brk-maximal.c 2015-10-16 08:42:24.000000000 +0200 @@ -62,17 +62,19 @@ BrkShot shot; }; -static void brk_pool_allocator_use (); -static void brk_pool_allocator_clear (); +static BrkPool * brk_pool_node_new (const BrkShot *shot, BrkEnv *env); +static void brk_pool_node_free (BrkPool *pool, BrkEnv *env); -static BrkPool * brk_pool_node_new (const BrkShot *shot); -static void brk_pool_node_free (BrkPool *pool); - -static void brk_pool_free (BrkPool *pool); +static void brk_pool_free (BrkPool *pool, BrkEnv *env); static BrkPool * brk_pool_get_node (BrkPool *pool); -static BrkPool * brk_pool_match (BrkPool *pool, BrkPool *node); +static BrkPool * brk_pool_match (BrkPool *pool, const BrkPool *node); static BrkPool * brk_pool_add (BrkPool *pool, BrkPool *node); -static BrkPool * brk_pool_delete (BrkPool *pool, BrkPool *node); +static BrkPool * brk_pool_delete_node (BrkPool *pool, BrkPool *node, + BrkEnv *env); + +struct _BrkEnv { + BrkPool *free_list; +}; /** * @brief Best break solution @@ -101,33 +103,23 @@ * PRIVATE METHODS DECLARATIONS * *----------------------------------*/ -static BrkPool * brk_root_pool (int pos_size); +static BrkPool * brk_root_pool (int pos_size, BrkEnv *env); static int brk_maximal_do_impl (const thwchar_t *ws, int len, const char *brkpos_hints, - int pos[], size_t n); + int pos[], size_t n, BrkEnv *env); static int brk_recover_try (const thwchar_t *ws, int len, const char *brkpos_hints, - size_t recov_words, int *last_brk_pos); + size_t recov_words, int *last_brk_pos, + BrkEnv *env); static int brk_recover (const thwchar_t *wtext, int len, int pos, - const char *brkpos_hints, RecovHist *rh); + const char *brkpos_hints, RecovHist *rh, + BrkEnv *env); /*---------------------* * PRIVATE GLOBALS * *---------------------*/ -void -brk_maximal_init () -{ - brk_pool_allocator_use (); -} - -void -brk_maximal_quit () -{ - brk_pool_allocator_clear (); -} - int -brk_maximal_do (const thchar_t *s, int len, int pos[], size_t n) +brk_maximal_do (const thchar_t *s, int len, int pos[], size_t n, BrkEnv *env) { char *brkpos_hints; thwchar_t *ws; @@ -143,7 +135,7 @@ goto err_brkpos_hints_created; th_tis2uni_line (s, ws, len + 1); - ret = brk_maximal_do_impl (ws, len, brkpos_hints, pos, n); + ret = brk_maximal_do_impl (ws, len, brkpos_hints, pos, n, env); free (ws); free (brkpos_hints); @@ -159,7 +151,8 @@ static int brk_maximal_do_impl (const thwchar_t *ws, int len, const char *brkpos_hints, - int pos[], size_t n) + int pos[], size_t n, + BrkEnv *env) { BrkPool *pool; BrkPool *node; @@ -167,7 +160,7 @@ RecovHist recov_hist; int ret; - pool = brk_root_pool (n); + pool = brk_root_pool (n, env); best_brk = best_brk_new (n); if (UNLIKELY (!best_brk)) return 0; @@ -175,7 +168,6 @@ while (NULL != (node = brk_pool_get_node (pool))) { BrkShot *shot = &node->shot; - BrkPool *match; int is_keep_node, is_terminal, is_recovered; int str_pos; @@ -192,7 +184,7 @@ /* try to recover from error */ recovered = brk_recover (ws, len, shot->str_pos + 1, - brkpos_hints, &recov_hist); + brkpos_hints, &recov_hist, env); if (-1 != recovered) { /* add penalty by recovered - recent break pos */ shot->penalty += recovered; @@ -236,7 +228,7 @@ !trie_state_is_single (shot->dict_state)) { /* add node to mark break position instead of current */ - node = brk_pool_node_new (shot); + node = brk_pool_node_new (shot, env); pool = brk_pool_add (pool, node); shot = &node->shot; } @@ -248,10 +240,14 @@ if (!is_keep_node || shot->str_pos == len || shot->cur_brk_pos >= n) { /* path is done; contest and remove */ best_brk_contest (best_brk, shot); - pool = brk_pool_delete (pool, node); + pool = brk_pool_delete_node (pool, node, env); } else { + BrkPool *pool_tail = pool; + BrkPool *match; + /* find matched nodes, contest and keep the best one */ - while (NULL != (match = brk_pool_match (pool, node))) { + while (NULL != (match = brk_pool_match (pool_tail, node))) { + BrkPool *next = match->next; BrkPool *del_node; if (match->shot.penalty < node->shot.penalty || @@ -259,11 +255,16 @@ match->shot.cur_brk_pos < node->shot.cur_brk_pos)) { del_node = node; + /* (match->next == node) -> also skip node */ + if (next == node) { + next = node->next; + } node = match; } else { del_node = match; } - pool = brk_pool_delete (pool, del_node); + pool = brk_pool_delete_node (pool, del_node, env); + pool_tail = next; } } } @@ -271,7 +272,7 @@ ret = best_brk->cur_brk_pos; memcpy (pos, best_brk->brk_pos, ret * sizeof (pos[0])); - brk_pool_free (pool); + brk_pool_free (pool, env); best_brk_free (best_brk); return ret; } @@ -279,18 +280,18 @@ static int brk_recover_try (const thwchar_t *ws, int len, const char *brkpos_hints, - size_t recov_words, int *last_brk_pos) + size_t recov_words, int *last_brk_pos, + BrkEnv *env) { BrkPool *pool; BrkPool *node; int ret; - pool = brk_root_pool (recov_words); + pool = brk_root_pool (recov_words, env); ret = 0; while (NULL != (node = brk_pool_get_node (pool))) { BrkShot *shot = &node->shot; - BrkPool *match; int is_keep_node, is_terminal; /* walk dictionary character-wise till a word is matched */ @@ -313,7 +314,7 @@ } while (!(is_terminal && brkpos_hints[shot->str_pos])); if (!is_keep_node) { - pool = brk_pool_delete (pool, node); + pool = brk_pool_delete_node (pool, node, env); break; } @@ -322,7 +323,7 @@ !trie_state_is_single (shot->dict_state)) { /* add node to mark break position instead of current */ - node = brk_pool_node_new (shot); + node = brk_pool_node_new (shot, env); pool = brk_pool_add (pool, node); shot = &node->shot; } @@ -336,27 +337,32 @@ ret = shot->cur_brk_pos; *last_brk_pos = shot->brk_pos[ret - 1]; } - pool = brk_pool_delete (pool, node); + pool = brk_pool_delete_node (pool, node, env); /* stop as soon as first solution is found */ if (ret == recov_words) goto recov_done; break; } else { - /* find matched nodes, contest and keep the best one */ - while (NULL != (match = brk_pool_match (pool, node))) { - pool = brk_pool_delete (pool, match); + BrkPool *pool_tail = pool; + BrkPool *match; + + /* find matched nodes and delete them */ + while (NULL != (match = brk_pool_match (pool_tail, node))) { + BrkPool *next = match->next; + brk_pool_delete_node (pool_tail, match, env); + pool_tail = next; } } } } recov_done: - brk_pool_free (pool); + brk_pool_free (pool, env); return ret; } static BrkPool * -brk_root_pool (int pos_size) +brk_root_pool (int pos_size, BrkEnv *env) { Trie *dict; BrkPool *pool; @@ -374,7 +380,7 @@ root_shot.str_pos = root_shot.cur_brk_pos = 0; root_shot.penalty = 0; - node = brk_pool_node_new (&root_shot); + node = brk_pool_node_new (&root_shot, env); if (LIKELY (node)) { pool = brk_pool_add (pool, node); } @@ -388,7 +394,8 @@ static int brk_recover (const thwchar_t *wtext, int len, int pos, - const char *brkpos_hints, RecovHist *rh) + const char *brkpos_hints, RecovHist *rh, + BrkEnv *env) { int last_brk_pos = 0; int n, p; @@ -402,7 +409,7 @@ for (p = pos; p < len; ++p) { if (brkpos_hints[p]) { n = brk_recover_try (wtext + p, len - p, brkpos_hints + p, - RECOVERED_WORDS, &last_brk_pos); + RECOVERED_WORDS, &last_brk_pos, env); if (n == RECOVERED_WORDS || (n > 0 && '\0' == wtext[last_brk_pos])) { @@ -456,40 +463,42 @@ free (shot->brk_pos); } -static BrkPool *brk_pool_free_list = NULL; -static int brk_pool_allocator_refcnt = 0; - -static void -brk_pool_allocator_use () +BrkEnv * +brk_env_new() { - ++brk_pool_allocator_refcnt; + BrkEnv *env = (BrkEnv *) malloc (sizeof (BrkEnv)); + if (UNLIKELY (!env)) + return NULL; + + env->free_list = NULL; + + return env; } -static void -brk_pool_allocator_clear () +void +brk_env_free (BrkEnv *env) { - if (--brk_pool_allocator_refcnt > 0) - return; - - while (brk_pool_free_list) { + while (env->free_list) { BrkPool *next; - next = brk_pool_free_list->next; - brk_shot_destruct (&brk_pool_free_list->shot); - free (brk_pool_free_list); - brk_pool_free_list = next; + next = env->free_list->next; + brk_shot_destruct (&env->free_list->shot); + free (env->free_list); + env->free_list = next; } + + free (env); } static BrkPool * -brk_pool_node_new (const BrkShot *shot) +brk_pool_node_new (const BrkShot *shot, BrkEnv *env) { BrkPool *node; - if (brk_pool_free_list) { + if (env->free_list) { /* reuse old node if possible */ - node = brk_pool_free_list; - brk_pool_free_list = brk_pool_free_list->next; + node = env->free_list; + env->free_list = env->free_list->next; brk_shot_reuse (&node->shot, shot); } else { node = (BrkPool *) malloc (sizeof (BrkPool)); @@ -507,21 +516,21 @@ } static void -brk_pool_node_free (BrkPool *pool) +brk_pool_node_free (BrkPool *pool, BrkEnv *env) { /* put it in free list for further reuse */ - pool->next = brk_pool_free_list; - brk_pool_free_list = pool; + pool->next = env->free_list; + env->free_list = pool; } static void -brk_pool_free (BrkPool *pool) +brk_pool_free (BrkPool *pool, BrkEnv *env) { while (pool) { BrkPool *next; next = pool->next; - brk_pool_node_free (pool); + brk_pool_node_free (pool, env); pool = next; } } @@ -553,26 +562,28 @@ } static BrkPool * -brk_pool_match (BrkPool *pool, BrkPool *node) +brk_pool_match (BrkPool *pool, const BrkPool *node) { int node_cur_pos; node_cur_pos = node->shot.cur_brk_pos; - while (pool) { - if (pool != node) { - if (node_cur_pos == 0) { - if (pool->shot.cur_brk_pos == 0) - break; - } else { - if (pool->shot.cur_brk_pos > 0 && - pool->shot.brk_pos[pool->shot.cur_brk_pos - 1] - == node->shot.brk_pos[node_cur_pos - 1]) - { - break; - } + if (node_cur_pos == 0) { + while (pool) { + if (pool != node && pool->shot.cur_brk_pos == 0) + break; + pool = pool->next; + } + } else { + int node_brk_pos = node->shot.brk_pos[node_cur_pos - 1]; + while (pool) { + if (pool != node && + pool->shot.cur_brk_pos > 0 && + pool->shot.brk_pos[pool->shot.cur_brk_pos - 1] == node_brk_pos) + { + break; } + pool = pool->next; } - pool = pool->next; } return pool; } @@ -585,7 +596,7 @@ } static BrkPool * -brk_pool_delete (BrkPool *pool, BrkPool *node) +brk_pool_delete_node (BrkPool *pool, BrkPool *node, BrkEnv *env) { if (pool == node) { pool = pool->next; @@ -597,7 +608,7 @@ if (p) p->next = node->next; } - brk_pool_node_free (node); + brk_pool_node_free (node, env); return pool; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/src/thbrk/brk-maximal.h new/libthai-0.1.23/src/thbrk/brk-maximal.h --- old/libthai-0.1.22/src/thbrk/brk-maximal.h 2015-05-06 10:13:19.000000000 +0200 +++ new/libthai-0.1.23/src/thbrk/brk-maximal.h 2015-10-16 08:49:34.000000000 +0200 @@ -29,14 +29,16 @@ #include <thai/thailib.h> -void -brk_maximal_init (); +typedef struct _BrkEnv BrkEnv; + +BrkEnv * +brk_env_new(); void -brk_maximal_quit (); +brk_env_free (BrkEnv *env); int -brk_maximal_do (const thchar_t *s, int len, int pos[], size_t n); +brk_maximal_do (const thchar_t *s, int len, int pos[], size_t n, BrkEnv *env); #endif /* __BRK_MAXIMAL_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/src/thbrk/thbrk.c new/libthai-0.1.23/src/thbrk/thbrk.c --- old/libthai-0.1.22/src/thbrk/thbrk.c 2015-05-06 10:13:19.000000000 +0200 +++ new/libthai-0.1.23/src/thbrk/thbrk.c 2015-10-16 08:55:47.000000000 +0200 @@ -104,6 +104,7 @@ int th_brk (const thchar_t *s, int pos[], size_t n) { + BrkEnv *env; brk_class_t prev_class, effective_class; const thchar_t *thai_chunk, *acronym_end, *p; int cur_pos; @@ -111,12 +112,12 @@ if (!*s) return 0; - brk_maximal_init (); - p = thai_chunk = acronym_end = s; prev_class = effective_class = brk_class (*p); cur_pos = 0; + env = brk_env_new(); + while (*++p && cur_pos < n) { brk_class_t new_class; brk_op_t op; @@ -149,7 +150,7 @@ int n_brk, i; n_brk = brk_maximal_do (thai_chunk, p - thai_chunk, - pos + cur_pos, n - cur_pos); + pos + cur_pos, n - cur_pos, env); for (i = 0; i < n_brk; i++) pos [cur_pos + i] += thai_chunk - s; cur_pos += n_brk; @@ -158,7 +159,7 @@ * note that even if it's allowed, the table-lookup * operation below will take care of it anyway */ - if (pos[cur_pos - 1] == p - s) + if (LIKELY (cur_pos > 0) && pos[cur_pos - 1] == p - s) --cur_pos; if (cur_pos >= n) @@ -198,7 +199,7 @@ int n_brk, i; n_brk = brk_maximal_do (thai_chunk, p - thai_chunk, - pos + cur_pos, n - cur_pos); + pos + cur_pos, n - cur_pos, env); for (i = 0; i < n_brk; i++) pos [cur_pos + i] += thai_chunk - s; cur_pos += n_brk; @@ -208,7 +209,7 @@ --cur_pos; } - brk_maximal_quit (); + brk_env_free (env); return cur_pos; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/test-driver new/libthai-0.1.23/test-driver --- old/libthai-0.1.22/test-driver 2014-10-27 05:45:43.000000000 +0100 +++ new/libthai-0.1.23/test-driver 2015-08-15 12:37:35.000000000 +0200 @@ -3,7 +3,7 @@ scriptversion=2013-07-13.22; # UTC -# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# Copyright (C) 2011-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -106,11 +106,14 @@ # Test script is run here. "$@" >$log_file 2>&1 estatus=$? + if test $enable_hard_errors = no && test $estatus -eq 99; then - estatus=1 + tweaked_estatus=1 +else + tweaked_estatus=$estatus fi -case $estatus:$expect_failure in +case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; @@ -119,6 +122,12 @@ *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>$log_file + # Report outcome to console. echo "${col}${res}${std}: $test_name" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libthai-0.1.22/tests/thsort.c new/libthai-0.1.23/tests/thsort.c --- old/libthai-0.1.22/tests/thsort.c 2015-05-06 10:15:05.000000000 +0200 +++ new/libthai-0.1.23/tests/thsort.c 2015-10-11 11:26:25.000000000 +0200 @@ -75,8 +75,8 @@ FILE *dataFile; FILE *outFile; size_t dataRead; - char DataFileName[64]; - char OutFileName[64]; + char DataFileName[512]; + char OutFileName[512]; if (argc == 3) { strcpy(DataFileName, argv[1]);
