Andrew Borodin
dc67246c27
Ticket #4374 : fix file sort by version.
...
filevercmp: don't treat entire filename as suffix.
Sync with gnulib 1ba2b66ea45f9bc43cdc0f6f93efa59157d2b2ba.
(file_prefixlen): When stripping (\.[A-Za-z~][A-Za-z0-9~]*)*$ suffixes,
do not strip the entire file name.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-04 09:01:43 +03:00
Andrew Borodin
7408272361
filevercmp: fix several unexpected results.
...
Sync with gnulib 9f48fb992a3d7e96610c4ce8be969cff2d61a01b.
Problems reported by Michael Debertol in <https://bugs.gnu.org/49239 >.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
09de50d3a1
(_str_convert): fix memory leak.
...
Found by Coverity.
Coverity id #348334 .
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin
2c205c5928
Update copyright years.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin
e71972003e
lib/strutil/strutilutf8.c: use MB_LEN_MAX constant.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
452074906a
(str_replace_all): use g_ptr_array_new_with_free_func().
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
a309e1e133
(str_ptr_array_join): return GString.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Andrew Borodin
9ee52e77c3
Ticket #4179 : code clean up before 4.8.27 release.
...
Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-14 19:30:42 +03:00
Marek Černocký
c8649068d3
Ticket #4194 : add .c++ and .h++ extensions for highlight.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-18 16:52:21 +03:00
Andreas Mohr
57f5ab7c23
Add break before empty default in switch.
...
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:47 +03:00
Andrew Borodin
5bf714b008
Ticket #4131 : use G_UNICODE_SPACING_MARK instead of G_UNICODE_COMBINING_MARK.
...
G_UNICODE_COMBINING_MARK is deperecated in glib >= 30.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-15 15:16:24 +03:00
Andrew Borodin
31b37a1f79
Ticket #4050 : code cleanup before 4.8.25 release.
...
Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-02-29 19:10:17 +03:00
Andrew Borodin
76a5f70f5b
Ticket #3992 : improve support of Windows 1251 encoding on Solaris.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-07-13 08:58:27 +03:00
Andrew Borodin
a2a5fa017e
Fix file version sort.
...
Use filevercmp() instead of str_verscmp().
Source code of filevercmp() is taken from Gnulib.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-03-02 11:24:07 +03:00
Andrew Borodin
2163009270
Ticket #3905 , 3956: fix file version sort.
...
* Update str_verscmp implementation: sync with Gnulib.
* Add tests. Testcases are taken from Gnulib.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-20 15:42:53 +03:00
Andrew Borodin
1dd8a47987
Ticket #3955 : code cleanup before 4.8.23 release.
...
Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2019-02-03 12:44:40 +03:00
Andrew Borodin
eb507862ff
(str_ptr_array_join): constify argument.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-09-09 19:10:43 +03:00
Andrew V. Samoilov
dfd6d99e1c
(str_8bit_encodings[], str_utf8_encodings[]): make const.
...
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew Borodin
52d1980c46
strutil: character test functions return gboolean instead of int.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
8b6f4ef2c2
Use gboolean instead of int in file/dir sort related functions.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
ddd645526a
Update copyright years.
2018-02-04 11:30:22 +03:00
devzero
7f9b333861
Ticket #3616 : speed up of utf-8 normalization.
...
When content of a large directory is being sorted by file names, a
significant amount of CPU time is spent in str_utf8_normalize() that is
called from str_utf8_create_key_gen().
For example, /usr/bin/ contains 5437 files on my Archlinux box. Running
mc /usr/bin/ /usr/bin/ takes approx. 75 000 000 CPU instructions to sort
file names, or 25% of total program run time. From these 75 000 000
instructions, 42 500 000 instruction are spent in str_utf8_normalize().
str_utf8_normalize() uses g_utf8_normalize() to do the work.
g_utf8_normalize() is a heavyweight function, that converts UTF-8 into
UCS-4, does the normalization and then converts UCS-4 back into UTF-8.
Since file names are composed of ASCII characters in most cases, we can
speed up str_utf8_normalize() by checking if the heavyweight Unicode
normalization is actually needed. Normalization of ASCII string is
no-op, so it is effectively "normalized" by just strdup().
With this patch, running mc /usr/bin/ /usr/bin/ requires just 37 000 000
instructions to sort the file names (down from 75 000 000) and 4 500 000
instuctions to do str_utf8_normalize() (down from 42 500 000).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-07-29 10:23:09 +03:00
Andrew Borodin
e9fd11bfcd
Update copyright years.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 19:12:55 +03:00
Andrew Borodin
2356acc26d
NULL-ize some variables to make unit tests happy.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
9a39e35dc3
Use g_assert() instead of assert(3).
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
b36cec44e3
Cleanup unused macros.
...
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin
bdb81cd482
Sync with gnulib 6ed53f13bc39d9a0252549e98a2a59441fb2351f.
...
lib/strutil/xstrtol.c: prohibit monstrosities like "1bB".
Problem reported by Young Mo Kang in: http://bugs.gnu.org/23388 .
(xstrtoumax): Allow trailing second suffixes like "B" only if the first
suffix needs a base.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:28:47 +03:00
Andrew Borodin
bc14ff44c8
Remove min() and max() macros. Use MIN() and MAX() macros from GLib.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
2d77cb32f9
lib/strutil/strutilutf8.c: grammar.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
41035995c8
lib/strutil/{strutil8bit.c,strutilutf8.c}: cleanup -Wcast-qual warning.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andrew Borodin
471ea781ca
Update copyright years.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-01-01 11:48:10 +03:00
Andrew Borodin
615eba776d
Ticket #3420 : code cleanup before 4.8.15 release.
...
lib/strutil/*.c: apply template.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-11-05 14:32:51 +03:00
Andrew Borodin
2789e6e390
Ticket #3431 : add missing default cases.
...
Introduce -Wswitch-default check.
Some minor cosmetics.
Thanks Andreas Mohr <and at gmx dot li> for original patch.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:50 +03:00
Andreas Mohr
bd051e4095
lib/strutil/strutil8bit.c: remove unused functions.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-05-03 19:43:49 +03:00
Andrew Borodin
8c88aa01ad
Remove code required for GLib < 2.14.0.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2015-02-26 09:20:54 +03:00
Andrew Borodin
454479549c
Update copyright years.
2015-02-26 09:12:08 +03:00
Slava Zanko
512ad7d962
Make working with GError in more right way (like with exceptions).
...
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2014-07-22 13:12:07 +04:00
Andrew Borodin
e6030d8e74
Sync with gnulib 94ee038129c3b40510ef0ff6ac6ddfe85bf0f97f.
...
(xstrtoumax): use enum instead of 0, to pacify IRIX 6.5 cc.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-07-22 13:12:06 +04:00
Andrew Borodin
a6c5c82fa0
(str_ascii_fit_to_term): fix out-of-bound write.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-07-22 13:10:41 +04:00
Andrew Borodin
4e5819d169
(str_8bit_fit_to_term): fix out-of-bound write.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-07-22 13:10:41 +04:00
Andrew Borodin
e5203cb023
Fix name of FSF in all *.c files.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:17 +04:00
Andrew Borodin
43bf10b170
Ticket #3167 : copyright issues.
...
lib/strutil/xstrtol.c: restore copyright line.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:16 +04:00
Andrew Borodin
f0da49345a
Collapse list of copyright years to ranges. Add 2014 year.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-10 16:27:03 +04:00
Slava Zanko
0d489acd58
cppcheck: reduce variable scope.
...
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-11-25 13:47:39 +04:00
Slava Zanko
0b0f7e3975
Refactoring: use define DEFAULT_CHARSET for "ASCII" charset.
...
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-09-21 13:35:59 +04:00
Andrew Borodin
f9eed1fcef
Indentation.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:15:29 +04:00
Andrew Borodin
17aef88637
lib/strutil/strutilutf8.c: cosmetics and minor refactoring.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00
Andrew Borodin
7ee58f73ff
lib/strutil/strutil8bit.c: cosmetics and minor refactoring.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00
Andrew Borodin
9e4d279885
lib/strutil/strutilascii.c: cosmetics and minor refactoring.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00
Andrew Borodin
5b91108b3c
lib/strutil/strutil.c: cosmetics and minor refactoring.
...
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:01:05 +04:00