aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memfile.c
Commit message (Collapse)AuthorAge
* refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)zeertzjq2022-08-11
| | | | | | | vim-patch:8.2.0559: clearing a struct is verbose Problem: Clearing a struct is verbose. Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER(). https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* refactor: convert macros to all-caps (#17895)dundargoc2022-04-24
| | | Closes https://github.com/neovim/neovim/issues/6297
* chore(fixup): bfredl size_tDundar Göc2022-01-01
|
* refactor: avoid overflow by explicitly casting operand to a wider typeDundar Göc2021-12-31
|
* refactor: saner options for uncrustify (#16204)dundargoc2021-11-19
| | | | | | | | | | | | | | | | | | | | | | | | * sp_enum_after_assign = force * sp_brace_typedef = force * nl_do_brace = remove * sp_do_brace_open = force * sp_brace_close_while = force * sp_before_semi = remove * sp_before_semi_for = remove * sp_before_semi_for_empty = remove * sp_between_semi_for_empty = remove * sp_after_semi_for_empty = remove * sp_before_square = remove * sp_before_squares = remove * sp_inside_square = remove * sp_inside_fparens = remove * sp_inside_fparen = remove * sp_inside_tparen = remove * sp_after_tparen_close = remove * sp_return_paren = force * pos_bool = lead * sp_pp_concat = remove * sp_pp_stringify = remove * fixup: disable formatting for the INIT section
* vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy2021-11-01
| | | | | | | | | Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
* refactor: format with uncrustify #15741dundargoc2021-09-22
|
* vim-patch:8.0.1496: VIM_CLEAR()Justin M. Keyes2019-05-25
| | | | | | | | Problem: Clearing a pointer takes two lines. Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi, closes #2629) vim-patch:8.0.1481
* cleanup: remove HAVE_SELINUX #10040Justin M. Keyes2019-05-21
| | | | We never define HAVE_SELINUX, and no one has asked for it. So remove the dead code.
* :recover : Fix crash on non-existent *.swp #9504raffitz2019-01-15
| | | | | | | Reverts d2944e6a298e. mf_open() _can_ fail if the file does not exist. closes #9503 closes #9504
* mf_open(): never fails (except for OOM)Justin M. Keyes2018-05-17
|
* Merge #4486 'refactor: Remove maxmem, maxmemtot options'Justin M. Keyes2018-05-02
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After this change we never release blocks from memory (in practice it never happened because the memory limits are never reached). Let the OS take care of that. --- On today's systems the 'maxmem' and 'maxmemtot' values are huge (4+ GB) so the limits are never reached in practice, but Vim wastes a lot of time checking if the limit was reached. If the limit is reached Vim starts saving pieces of the swap file that were in memory to the disk. Said in a different way: Vim implements its own memory-paging mechanism. This is unnecessary and inefficient since the operating system already has virtual memory and will swap to the disk if programs start using too much memory. This change does... 1. Reduce the number of config options and need for documentation. 2. Make the code more efficient as we don't have to keep track of memory usage nor check if the memory limits were reached to start swapping to disk every time we need memory for buffers. 3. Simplify the code. Once memfile.c is simple enough it could be replaced by actual operating system memory mapping (mmap, MemoryViewOfFile...). This change does not prevent Vim to recover changes from swap files since the swapping code is never triggered with the huge limits set by default.
| * Remove the mf_dont_release global after getting rid of maxmem[tot]Felipe Oliveira Carvalho2017-04-11
| |
| * Remove maxmem and maxmemtot optionsFelipe Oliveira Carvalho2017-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > The option 'maxmem' ('mm') is used to set the maximum memory used for one > buffer (in kilobytes). 'maxmemtot' is used to set the maximum memory used for > all buffers (in kilobytes). The defaults depend on the system used. These > are not hard limits, but tell Vim when to move text into a swap file. If you > don't like Vim to swap to a file, set 'maxmem' and 'maxmemtot' to a very large > value. The swap file will then only be used for recovery. If you don't want > a swap file at all, set 'updatecount' to 0, or use the "-n" argument when > starting Vim. On today's systems these values are huge (4GB in my machine with 8GB of RAM since it's set as half the available memory by default) so the limits are never reached in practice, but Vim wastes a lot of time checking if the limit was reached. If the limit is reached Vim starts saving pieces of the swap file that were in memory to the disk. Said in a different way: Vim implements its own memory swapping mechanism. This is unnecessary and inefficient since the operating system already virtualized the memory and will swap to the disk if programs start using too much memory. This change does... 1. Reduce the number of config options and need for documentation. 2. Make the code more efficient as we don't have to keep track of memory usage nor check if the memory limits were reached to start swapping to disk every time we need memory for buffers. 3. Simplify the code. Once `memfile.c` is simple enough it could be replaced by actual operating system memory mapping (`mmap`, `MemoryViewOfFile`...). This change does not prevent Vim to recover changes from swap files since the swapping code is never triggered with the huge limits set by default.
* | vim-patch:8.0.0074Michael Schupikov2017-12-15
| | | | | | | | | | | | | | | | | | | | Problem: Cannot make Vim fail on an internal error. Solution: Add IEMSG() and IEMSG2(). (Domenique Pelle) Avoid reporting an internal error without mentioning where. https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f Signed-off-by: Michael Schupikov <michael@schupikov.de>
* | io: more guards against NULL filename (#7159)Justin M. Keyes2017-08-13
| | | | | | | | References ac055d677aa9 References #4370
* | vim-patch:7.4.1975James McCoy2017-06-04
| | | | | | | | | | | | | | | | | | | | | | Problem: On MS-Windows large files (> 2Gbyte) cause problems. Solution: Use "off_T" instead of "off_t". Use "stat_T" instead of "struct stat". Use 64 bit system functions if available. (Ken Takata) https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe Only the off_T changes are relevant, since all the "struct stat" usage is abstracted by libuv.
* | memfile: Fix V547: always true conditionZyX2017-05-20
| | | | | | | | | | `blocksize` was checked against UINT_MAX after it was checked against MAX_SWAP_PAGE_SIZE which makes it always pass the check. Better use STATIC_ASSERT instead.
* | *: Add comment to all C filesZyX2017-04-19
|/
* job-control: set CLOEXEC on pty processes. #5986Matthew Malcomson2017-03-17
| | | | | Before this change, new processes started with libuv prevented SIGHUP from reaching pty processes (by keeping the ptmx file descriptor open).
* refactor: eliminate misc2.cJustin M. Keyes2016-09-13
| | | | | | | | | | 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
* vim-patch:7.4.1276Michael Ennen2016-05-17
| | | | | | | Problem: Warning for not using return value of fcntl(). Solution: Explicitly ignore the return value. https://github.com/vim/vim/commit/fbc4b4db3a9690906a96e16724350a6241cf32a5
* Review of the memfile.c API and small refactoringsFelipe Oliveira Carvalho2016-03-16
| | | | | | | | | - Create `mf_free_fnames()` that frees and nullifies `mf_[f]fname` - Create `mf_set_fnames()` to set the `mf_fname` and the `mf_ffname` altoghether - Have `mf_do_open` return a bool to indicate success so that calles don't have to check `memfile_T::mf_fd` (file descriptor) - Inline `mf_write_block`
* Windows: Include <fcntl.h> for file constants.Seth Jackson2016-01-17
| | | | | | This header is required by POSIX for the constants (O_RDONLY, etc.) but we were only including it on Unix systems as a side effect of including <unistd.h>.
* Remove swapsync.Seth Jackson2016-01-14
| | | | It's complete overkill.
* Port fsync() to libuv.Seth Jackson2016-01-01
|
* src/*: Remove `VIM - Vi improved ...` headerMichael Reed2015-11-27
| | | | | | | | | | | | | | | | | | | Regarding the individual items in the header: `Vim - Vi improved by Bram Moolenar` Bram Moolenar is already mentioned throughout the documentation, as well as the intro screen. `:help uganda` It's already shown to all users who don't use `shortmess+=I` upon starting nvim, and is already placed prominently in help.txt, i.e., `:help` run with no arguments. `:help credits` Already mentioned near the top of help.txt. `README.md` Already mentioned in develop.txt.
* Remove unnecessary includes for errno.hRui Abreu Ferreira2015-11-25
|
* src: README.txt -> README.mdMichael Reed2015-11-23
| | | | | The former no longer exists in this repo; see the top of src/nvim/README.md.
* Remove char_u: FullName_save()Mark Bainter2015-05-06
|
* memory: Add `free` wrapper and refactor project to use itThiago de Arruda2015-04-13
| | | | | | We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
* refactor: split some more functions from misc1.cbobtwinkles2015-03-24
| | | | | | | | | | | This commit pulls the some environment-variable handling functions out of misc1.c and in to os/env.c. Previously submited as #1231, this is the start of a patch series that does that work based on a more up-to-date master branch. Major tasks accomplished: - move functions and fix includes - fix clint/clang analysis warnings - correct documentation comments
* refactor: Remove term modules and termcap optionsThiago de Arruda2015-02-21
| | | | | | | | | | | | | | | - Removed term.c, term.h and term_defs.h - Tests for T_* values were removed. screen.c was simplified as a consequence(the best strategy for drawing is implemented in the UI layer) - Redraw functions now call ui.c functions directly. Updates are flushed with `ui_flush()` - Removed all termcap options(they now return empty strings for compatibility) - &term/&ttybuiltin options return a constant value(nvim) - &t_Co is still available, but it mirrors t_colors directly - Remove cursor tracking from screen.c and the `screen_start` function. Now the UI is expected to maintain cursor state across any call, and reset it when resized. - Remove unused code
* ui: Remove redundant ui.h includesThiago de Arruda2014-11-27
| | | | Also move read_error_exit to os/input.c
* ui: Remove ui_delay, ui_breakcheck and ui_set_shellsizeThiago de Arruda2014-11-27
| | | | | These functions only used to call another os_* function, so remove them and replace all occurences in the project.
* ui: Remove ui_inchar/ui_char_availThiago de Arruda2014-11-27
| | | | | | | | | Also: - Remove NO_CONSOLE_INPUT/NO_CONSULE preprocessor conditionals - Remove ctrl_c_interrupts variable, check for mapped_ctrl_c directly in process_interrupts() - Move ui_inchar profiling to input_poll which is where Nvim blocks for input.
* Review: Remove long_u: memfile: Add to clint.Eliseo Martínez2014-11-06
|
* Review: Remove long_u: memfile: Refactor: blocknr_T: long -> int64_t.Eliseo Martínez2014-11-06
| | | | | Replace long with int64_t. Apart from being convenient, not using long is required by clint.
* Review: Remove long_u: memfile: Refactor: int -> bool.Eliseo Martínez2014-11-06
| | | | Replace int with bool where appropriate.
* Review: Remove long_u: memfile: Refactor: bhdr_T.bh_data: char_u* -> void*.Eliseo Martínez2014-11-06
| | | | | This, in addition to being more correct, allows removing a lot of explicit casts.
* Review: Remove long_u: memfile: Refactor: mf_hashtab_T.mht_fixed: Remove.Eliseo Martínez2014-11-06
| | | | Unused since 457bb2615154946d273d75e07f5d5a936f50ede0.
* Review: Remove long_u: memfile: Refactor: long_u -> size_t.Eliseo Martínez2014-11-06
| | | | | | | | | | | | | | | | | | - memfile_defs.h: * hashtab_T: mht_mask: long_u -> size_t. Masks are used to truncate keys to a value adequate for an index in the array of entries. Value of the mask plus one is the current size of the array. Both of those reasons imply the soundness of size_t for this type. * hashtab_T: mht_count: long_u -> size_t. - memfile.c: * total_mem_used: long_u -> size_t. * mf_hash_free_all: idx: long_u -> size_t. * mf_hash_add_item: idx: long_u -> size_t. * mf_hash_find: idx: long_u -> size_t. * mf_hash_grow: i: long_u -> size_t. * mf_hash_grow: j: long_u -> size_t.
* Review: Remove long_u: memfile: Enable -Wconversion.Eliseo Martínez2014-11-06
| | | | | | | | | | | | | - Add memfile.c to converted files list. - Fix conversion issues: * bhdr_T : bh_page_count : int -> unsigned. * bhdr_T : bh_flags : char -> unsigned. * mf_new() : page_count : int -> unsigned. * mf_get() : page_count : int -> unsigned. * mf_release() : page_count : int -> unsigned. * mf_alloc_bhdr() : page_count : int -> unsigned. * mf_trans_add() : page_count : int -> unsigned. * mf_put() : flags : int -> unsigned.
* Review: Remove long_u: memfile: Cleanup: Fix naming inconsistencies.Eliseo Martínez2014-11-06
| | | | | | - Drop '_S' suffix for struct names. - Make struct names match corresponding type's name (just removing '_S' suffix). - Rename NR_TRANS type/struct (just ugly).
* Review: Remove long_u: memfile: Cleanup: Others.Eliseo Martínez2014-11-06
| | | | | | | | | | | | memfile_defs.h: - Inline struct definitions in typedefs. - Move memfile_T definition to this file (weirdly, was in buffer_defs.h). memfile.c: - Use C99 style variable declarations. This is, move variable declarations as near to first-usage point as possible). - Modernize old-style function declarations. - Fix indent at some places (some multiline expressions and the like).
* Review: Remove long_u: memfile: Cleanup: Comments.Eliseo Martínez2014-11-06
| | | | | - Restyle comments (/// when appropiate, // otherwise). - Improve comments (add new comments, augment/clarify existing ones).
* fileinfo: rename os_get_file_info{,_link,_fd}Stefan Hoffmann2014-08-31
|
* fileinfo: implement os_fileinfo_blocksizeStefan Hoffmann2014-08-31
|
* FOR_ALL_BUFFERS use locally declared buffer pointerWayne Rowcliffe2014-08-17
|