Commit Graph

1475 Commits

Author SHA1 Message Date
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 V. Samoilov
d78fc418ec (get_codepage_index): minor optimizations.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
35376105d4 (vfs_url_split): Fix 2 memory leaks found by valgrind.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew V. Samoilov
6f6c676776 (mc_event_mass_add): make events const.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2018-02-04 11:30:23 +03:00
Andrew Borodin
af466458b7 vfs: create enum vfs_linear_state_t instead of defines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
95e1ab3064 vfs: use LS_NOT_LINEAR constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
cb354e5490 (vfs_file_handler_t::changed): change type from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
a514ce6d13 (vfs_s_super::want_stale): change type from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andrew Borodin
f1d9b67bb5 lib/vfs/direntry.c: apply cpding style; cosmetics.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:23 +03:00
Andreas Mohr
6aa2cb1cad (my_systemv): cleanup implicit-fallthrough warning.
Found by GCC 7.2.0

utilunix.c: In function 'my_systemv':
utilunix.c:455:13: error: this statement may fall through [-Werror=implicit-fallthrough=]
             my_exit (127);      /* Exec error */
             ^~~~~~~~~~~~~
utilunix.c:458:5: note: here
     default:
     ^~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
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
Andrew Borodin
a38accd389 (mc_realpath): ignore path encoding.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
6e994011f5 (vfs_path_url_split): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
73979369d1 Support __attribute__((fallthrough)) if possible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
b7c54f64bb (vfs_mkstemps): don't allocate a large memory chunk.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2018-02-04 11:30:22 +03:00
Andrew Borodin
48d85a42b4 achown: add callback for permission buttons
...to change behaviour of WButton objects.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-10 09:19:15 +03:00
Andrew Borodin
069306eb2e Ticket #3883: size_trunc_sep() breaks on multibyte locales.
The bug was introduced in b3867a6e15.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-12-02 14:41:35 +03:00
Andrew Borodin
6310e07745 (button_callback): clean up unneeded type casting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:30 +03:00
Andrew Borodin
3424622d5a (vfs_path_from_str_deprecated_parser, vfs_path_from_str_uri_parser): remove unused flags argument.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
8715c41a47 (vfs_path_from_str_uri_parser): fix detection of relative path.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
cebede5e84 (diff_two_paths): optimizate path comparision.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
72056890a7 (diff_two_paths): minor optimization: exit loop ASAP.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew Borodin
02effb2499 (diff_two_paths): reduce variable scopes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 16:01:29 +03:00
Andrew V. Samoilov
bf5abff937 (buttonbar_call): fix possible NULL dereference.
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
2017-11-17 16:01:29 +03:00
Andrew Borodin
7772f00aab Ticket #3780: code clean up before 4.8.20 release.
Direct include <limits.h> for MB_LEN_MAX.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-11-17 15:59:44 +03:00
Maksim Dzabraev
16b569986e Ticket #3870: fix INPUT_COMPLETE_CD in quick widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-10-28 19:18:23 +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
Yury V. Zaytsev
f0414be51d Zero struct stat tv_nsec (if supported) whenever st is filled manually
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-05-17 21:18:58 +02:00
Andrew Borodin
ff1510de1f File panel: unification of terminology.
Use 'list(ing) format' instead of 'list(ing) type' and 'list(ing) mode'.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
b56a77e02f Refactoring: handle panel listing mode switch in the panel level
...instead of top level.

Rename and move main/PanelListingSwitch keybind to panel/ListingSwitch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-24 16:16:27 +03:00
Andrew Borodin
f4eb2c47c9 Indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-14 18:54:22 +03:00
Thomas Dickey
4d46a10862 Ticket #3697: (tty_init): unify curses initialization
...for various curses implementations.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-04-14 14:06:13 +03:00
Yury V. Zaytsev
151b08b412 Ticket #3693: clarify that lack of noreturn attribute is on purpose
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2017-03-04 18:52:12 +01:00
Yury V. Zaytsev
f09d863ddf Revert "(my_exit): cleanup no attribute noreturn warning."
This reverts commit b91ab44b43.
2017-03-04 18:27:02 +01:00
Mooffie
ac23a4807c Pressing <right> and <left> in hotlist dialog doesn't refresh it.
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-26 12:38:39 +02:00
Yury V. Zaytsev
ab4fcb6d30 Revert "Ticket #3687: store the 'hotlist' file in data dir, not config dir."
This reverts commit 306b30ed30.
2017-02-24 21:32:01 +01:00
Mooffie
5ea5c5deb6 Ticket #3760: Fix aborts of MSG_MOUSE_DOWN.
This patch was supposed to get committed as part of #3571 but this never
happened. We commit it now as we depend on its functionality for the next
commit.

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-02-19 00:04:38 +02:00
Andrew Borodin
e83409b6d7 Ticket #3766: add_widget_autopos() doesn't remove focus from the previously focused widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-02-09 17:49:34 +02:00
Mooffie
bc46978036 (dialog_switch_list): simplify the listbox selector.
We use the new run_listbox_with_data().

Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-29 23:32:13 +02:00
Mooffie
11c1aff4d3 Ticket #3763: introduce run_listbox_with_data().
Signed-off-by: Mooffie <mooffie@gmail.com>
2017-01-29 23:32:04 +02: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
28ca14d73a Aggressive use of whitespace() and whiteness() macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
e0c02c9c77 WCheck, WRadio: send MSG_MOTIFY without parameter.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andreas Mohr
469dc1352b (tty_color_get_name_by_index): cleanup format compiler warning.
Found by GCC 6.2.0.

color-internal.c:186:33: error: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'int' [-Werror=format=]

Signed-off-by: Andreas Mohr <and@gmx.li>
2017-01-22 18:44:22 +03:00
Andrew Borodin
37de8e6253 (mc_search__g_regex_match_full_safe): don't use negative string length.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
1ff4005228 Use g_queue_free_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Mooffie
c0abaa6508 (mc_search__cond_struct_new_regex_ci_str): add documentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
8b14798cc4 setup: split integer and boolean options.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
c4550374b2 Change type from int to gboolean for variables controlled by checkboxes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00
Andrew Borodin
5e2f4a8069 WCheck: change type of 'state' from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2017-01-22 18:44:22 +03:00