Commit Graph

122 Commits

Author SHA1 Message Date
Dundar Göc
24a1880866 refactor: reduce number of unique char casts 2021-10-13 18:26:18 +02:00
dundargoc
f4ca3a29dd refactor: reformat with uncrustify #15736
* fix function parameter comments
* remove space after star in function names
2021-09-20 09:35:41 -07:00
James McCoy
27a7a4d384 Use abort() instead of assert(false) for things that should never happen
assert() is compiled out for release builds, but we don't want to
continue running in these impossible situations.

This also resolves the "implicit fallthrough" warnings for the asserts
in switch cases.
2021-01-31 11:28:52 -05:00
Andrea Cedraro
4c7ad9527d Add v:event flag on DirChanged signaling switching window (#13153)
Closes #9909
2020-11-07 12:02:06 -05:00
Jan Edmund Lazo
09232958ff vim-patch:8.1.2120: some MB_ macros are more complicated than necessary
Problem:    Some MB_ macros are more complicated than necessary. (Dominique
            Pelle)
Solution:   Simplify the macros.  Expand inline.
1614a14901
2019-10-06 21:11:38 -04:00
Jan Edmund Lazo
6508215b5c Remove excess <stdint.h> 2019-09-11 22:27:45 -04:00
Justin M. Keyes
c76c798bf6 vim-patch:8.1.0843: memory leak when running "make test_cd" #9944
closes #9921
reverts f0a702d116

Problem:    Memory leak when running "make test_cd".
Solution:   Free the stack element when failing. (Dominique Pelle,
            closes vim/vim#3877)
e0de2164f6
2019-04-28 16:54:00 +02:00
Marco Hinz
a0da692fce chdir: remove unused argument #9901 2019-04-14 00:08:18 +02:00
Jan Edmund Lazo
e09e9ca810 lint 2018-07-27 18:43:53 -04:00
Jan Edmund Lazo
f0a702d116 file_search: free stackp if vim_findfile() failed
ff_free_stack_element() accepts NULL ptr and returns early.
This removes the need to check if stackp is not NULL.
2018-07-24 01:15:24 -04:00
Jan Edmund Lazo
563957e3cb vim-patch:8.0.0493: crash with cd command with very long argument
Problem:    Crash with cd command with very long argument.
Solution:   Check for running out of space. (Dominique Pellé, closes vim/vim#1576)
15618fa643
2018-07-22 19:34:58 -04:00
ZyX
11f6411771 file_search: Silence PVS/V614: used buffer is never uninitialized 2018-04-15 20:18:20 +03:00
Marco Hinz
cca407b43e DirChanged: support <buffer> (#8140) 2018-03-16 07:29:20 +01:00
George Zhao
06994e0e21 Fix warning about conversion on mingw64 2018-01-18 21:30:03 +08:00
ZyX
c2f3e361c5 *: Add comment to all C files 2017-04-19 19:11:50 +03:00
Björn Linse
db9ef6263e mbyte: replace vim_tolower with mb_tolower handling locale correctly 2017-04-10 12:01:40 +02:00
ZyX
4bcee96347 *: Fix some Windows-specific warnings
Also fixed an error in path_fnamecmp().
2017-03-29 10:08:42 +03:00
ZyX
2dcfc439b2 eval: Split and move dict_add_nr_str to typval.c
Function was split into tv_dict_add_nr() and tv_dict_add_str().
2017-03-29 10:07:43 +03:00
ZyX
983a5532ca eval: Move dict_set_keys_readonly to typval.c 2017-03-29 10:07:43 +03:00
ZyX
e18a578308 *: Move some dictionary functions to typval.h and use char*
Also fixes buffer reusage in setmatches() and complete().
2017-03-29 10:07:42 +03:00
Justin M. Keyes
c5e61b41a5 DirChanged: avoid redundant events on 'autochdir' 2017-03-12 15:45:50 +01:00
Justin M. Keyes
d9fcbc2cfb DirChanged: trigger when switching scopes
Closes #6054
2017-03-12 14:39:32 +01:00
Justin M. Keyes
99a1a58c66 DirChanged: Publish _after_ updating win/tab CWD.
So getcwd() works correctly during DirChanged event.

Closes #6260
2017-03-12 14:39:32 +01:00
ZyX
efa2682e3b *: Partial string handling refactoring
Main points:

- Replace `char_u` with `char` in some cases.
- Remove `str[len] = NUL` hack in some cases when `str` may be considered
  `const`.
2017-02-15 02:48:33 +03:00
Tommy Allen
bdfa1479d2 eval.c: Fix findfile(), :find, gf in :terminal. #6009
Closes #4299
2017-01-31 00:48:30 +01:00
Justin M. Keyes
73da522d73 errors: Introduce "E856: Filename too long" 2017-01-23 15:49:37 +01:00
cztchoice
6e75bb5cbb refactor: strlcat instead of str{n}cat.
Add xstrlcat function.

Closes #3042
References #988
References #1069

coverity: 71530, 71531, 71532
2017-01-23 15:49:36 +01:00
Justin M. Keyes
be4c896845 DirChanged: set <amatch> (#5961)
Also:
- test that DirChanged is not recursive
- fix 'not trigger if :cd fails' test on Windows
2017-01-17 10:47:20 +01:00
Marco Hinz
a05779aa1c Move apply_autocmd_dirchanged() to vim_chdir() 2017-01-13 15:29:59 +01:00
Marco Hinz
197f50bf9a Trigger DirChanged on 'autochdir' 2017-01-13 15:29:04 +01:00
Shougo
2380747ff2 vim-patch:7.4.1909 (#5748)
Problem:    Doubled semicolons.
Solution:   Reduce to one. (Dominique Pelle)

945ec093cd
2016-12-10 13:40:29 +01:00
Justin M. Keyes
df072c3b2b refactor: eliminate misc2.c
move `call_shell` to misc1.c
Move some fns to state.c
Move some fns to option.c
Move some fns to memline.c
Move `vim_chdir*` fns to file_search.c
Move some fns to new module, bytes.c
Move some fns to fileio.c
2016-09-13 16:20:09 +02:00
Daniel Xu
5f1a153831 os/fs: Rename os_file_exists to os_path_exists (#4973)
Because the old name did not indicate that the function
would return true on directories as well.
2016-07-06 01:40:25 -04:00
James McCoy
667c1dc4de vim-patch:7.4.1108 (#4872)
Problem:    Expanding "~" halfway a file name.
Solution:   Handle the file name as one name. (Marco Hinz)  Add a test.
            Closes vim/vim#564.

58adb14739
2016-06-03 23:18:40 -04:00
Michael Ennen
c72b60645c Windows: find_file_in_path: Handle absolute path. #4711
Originally in vim/vim.
2016-05-06 00:53:47 -04:00
Justin M. Keyes
498eb02049 Merge pull request #4239 from jbradaric/vim-7.4.885
vim-patch:7.4.885
2016-02-17 04:31:21 -05:00
Jurica Bradaric
d12460123e vim-patch:7.4.885
Problem:    When doing an upwards search without wildcards the search fails if
            the initial directory doesn't exist.
Solution:   Fix the non-wildcard case. (Stefan Kempf)

c79a5452ac
2016-02-11 22:55:00 +01:00
Jurica Bradaric
a21becf7ee vim-patch:7.4.877
Problem:    ":find" sometimes fails. (Excanoe)
Solution:   Compare current characters instead of previous ones.

4d0c7bc74a
2016-02-11 22:31:19 +01:00
Jurica Bradaric
b86553c7ad file_search: Change return type of ff_wc_equal to bool.
This makes sense since the function returns only TRUE or FALSE.
2016-02-09 23:12:50 +01:00
Jurica Bradaric
c9898e0ec3 vim-patch:7.4.843
Problem:    Still possible to go beyond the end of a string.
Solution:   Check for NUL also in second string. (Dominique Pelle)

d43f0951bc
2016-02-09 23:08:24 +01:00
Jurica Bradaric
ab8a771dbd file_search: Declare loop variables inside the loop. 2016-02-09 23:08:24 +01:00
Jurica Bradaric
e8dd996703 vim-patch:7.4.835
Problem:    Comparing utf-8 sequences does not handle different byte sizes
            correctly.
Solution:   Get the byte size of each character. (Dominique Pelle)

f6470c288c
2016-02-09 23:08:24 +01:00
Jurica Bradaric
8b86f1103a vim-patch:7.4.642
Problem:    When using "gf" escaped spaces are not handled.
Solution:   Recognize escaped spaces.

d45c07ac74
2016-01-22 19:28:17 +01:00
Rui Abreu Ferreira
4f24b9e06f Remove unnecessary includes for errno.h 2015-11-25 16:38:33 -05:00
Mark Bainter
7747bf64d8 minor cleanup. #2610
Update vim_isAbsName() to use bool type
cleanup casts in vim_findfile() and recover_names()

References #2470
2015-05-13 19:42:31 -04:00
Michael Reed
3c5864772f Remove char_u: message:smsg() 2015-05-13 15:29:50 -04:00
Mark Bainter
80180bf94e Remove char_u: FullName_save() 2015-05-06 21:25:04 -05:00
Mark Bainter
789c448d19 Remove char_u: path_with_url() 2015-05-06 21:25:04 -05:00
Mark Bainter
f813fdce38 Remove char_u: add_pathsep() 2015-05-06 21:25:04 -05:00
Eliseo Martínez
7c956dcbe8 Enable -Wconversion: normal.c.
Refactor summary:
- extern int opcount --> extern long opcount
- bool find_decl(..., int len, ...) --> bool find_decl(..., size_t len, ...)
  * int find_ident_under_cursor(...) --> size_t find_ident_under_cursor(...)
    - int find_ident_at_pos(...) --> size_t find_ident_at_pos(...)
    - int modify_fname(..., int *usedlen, ..., int *fnamelen) --> int modify_fname(..., size_t *usedlen, ..., size_t *fnamelen)
      * char_u *eval_vars(..., int *usedlen, ...) --> char_u *eval_vars(..., size_t *usedlen, ...)
        - int find_cmdline_var(..., int *usedlen) --> ssize_t find_cmdline_var(..., size_t *usedlen)
        - static char_u *repl_cmdline(..., int srclen, ...) --> static char_u *repl_cmdline(..., size_t srclen, ...)
    - bool get_visual_text(..., int *lenp) --> bool get_visual_text(..., size_t *lenp)
      * char_u *find_file_name_in_path(..., int len, ...) --> char_u *find_file_name_in_path(..., size_t len, ...)
        - static char_u *eval_includeexpr(..., int len) --> static char_u *eval_includeexpr(..., size_t len)
        - char_u *find_file_in_path(..., int len, ...) --> char_u *find_file_in_path(..., size_t len, ...)
          * char_u *find_file_in_path_option(..., int len, ...) --> char_u *find_file_in_path_option(..., size_t len, ...)
            - char_u *find_directory_in_path(..., int len, ...) --> char_u *find_directory_in_path(..., size_t len, ...)
      * int spell_move_to(...) --> size_t spell_move_to(...)
        - int spell_check(...) --> size_t spell_check(...)
        - static int spell_bad_len --> static size_t spell_bad_len
    - void find_pattern_in_path(..., int len, ...) --> void find_pattern_in_path(..., size_t len, ...)

Helped-by: Justin M. Keyes <justinkz@gmail.com>
2015-04-27 19:27:07 +02:00