aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/garray.c
Commit message (Collapse)AuthorAge
* refactor: iwyu #31637Justin M. Keyes2024-12-23
| | | Result of `make iwyu` (after some "fixups").
* refactor: collapse statements in single assignmentsLewis Russell2024-07-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Variables are often assigned multiple places in common patterns. Solution: Replace these common patterns with different patterns that reduce the number of assignments. Use `MAX` and `MIN`: ```c if (x < y) { x = y; } // --> x = MAX(x, y); ``` ```c if (x > y) { x = y; } // --> x = MIN(x, y); ``` Use ternary: ```c int a; if (cond) { a = b; } els { a = c; } // --> int a = cond ? b : c; ```
* refactor(IWYU): fix headersdundargoc2024-01-11
| | | | | | Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want.
* build: don't define FUNC_ATTR_* as empty in headers (#26317)zeertzjq2023-11-30
| | | | | | FUNC_ATTR_* should only be used in .c files with generated headers. Defining FUNC_ATTR_* as empty in headers causes misuses of them to be silently ignored. Instead don't define them by default, and only define them as empty after a .c file has included its generated header.
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* build: remove PVSdundargoc2023-11-12
| | | | | | | We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* refactor: use uint8_t for blobs and ga_append() (#21916)zeertzjq2023-01-21
| | | | | | A blob is used as a sequence of bytes and usually accessed individually, not as as a NUL-terminuated string, so uint8_t should be better. Not sure about ga_append(), but using uint8_t leads to fewer casts.
* refactor: replace char_u with char 22 (#21786)dundargoc2023-01-17
| | | Work on https://github.com/neovim/neovim/issues/459
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* refactor: clint (#20600)Lewis Russell2022-10-12
|
* refactor: replace char_u with charDundar Göc2022-09-11
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-09-10
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: pre-incr to post-incrLewis Russell2022-08-25
|
* refactor: replace char_u with charDundar Goc2022-07-31
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: convert macros to all-caps (#17895)dundargoc2022-04-24
| | | Closes https://github.com/neovim/neovim/issues/6297
* refactor: reduce number of unique char castsDundar Göc2021-10-13
|
* refactor: reduce number of unique char casts (#15995)dundargoc2021-10-12
|
* refactor: reformat with uncrustify #15736dundargoc2021-09-20
| | | | * fix function parameter comments * remove space after star in function names
* vim-patch:8.1.1439: ga_grow(): 1.5x growth rate #10699Jan Edmund Lazo2019-08-05
| | | | | | Problem: Json_encode() is very slow for large results. Solution: In the growarray use a growth of at least 50%. (Ken Takata, closes vim/vim#4461) https://github.com/vim/vim/commit/c47ed44be76a520ded90913099771999c8a79eeb
* PVS/V1028: cast operands, not the resultJustin M. Keyes2019-02-14
|
* *: Add comment to all C filesZyX2017-04-19
|
* 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
* *: Fix gcc warningsZyX2016-04-18
|
* eval: Add jsonencode() functionZyX2016-04-18
| | | Ref #3471
* vim-patch:7.4.944watiko2016-01-10
| | | | | | | | | Problem: Writing tests for Vim script is hard. Solution: Add assertEqual(), assertFalse() and assertTrue() functions. Add the v:errors variable. Add the runtest script. Add a first new style test script. https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
* garray.c: Prevent ga_concat() using memcpy(NULL,...)oni-link2015-09-30
| | | | | | Calling ga_grow(gap, 0) does not reallocate memory for garray gap. Because of this, gap->ga_data can be NULL after such a call, if gap does not have memory allocated.
* 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.
* ui: Remove/adapt some old code for a big UI refactorThiago de Arruda2015-02-16
| | | | | | | | | | | | | - Remove abstract_ui global, now it is always active - Remove some terminal handling code - Remove unused functions - Remove HAVE_TGETENT/TERMINFO/TERMIOS/IOCTL #ifdefs - Remove tgetent/terminfo from version.c - Remove curses/terminfo dependencies - Only start/stop termcap when starting/exiting the program - msg_use_printf will return true if there are no attached UIs( messages will be written to stdout) - Remove `ex_winpos`(implement `:winpos` with `ex_ni`)
* Macro cleanup: PROTOMichael Reed2015-01-14
| | | | | | Regarding dict_lookup() in eval.c: both definitions are the same, the only difference being the spacing between the indirection operator and the indentation level.
* GA_DEEP_FREE_PTR: deep free macro for garrays that store simple pointersFelipe Oliveira Carvalho2014-12-11
| | | | | | | By "simple pointer" I mean a pointer that can be freed with a call to `free` without leaking any member pointer. This macro does exactly what `ga_clear_strings` does.
* Merge pull request #1019 from splinterofchaos/globpathJustin M. Keyes2014-08-18
|\ | | | | vim-patch:7.4.279
| * vim-patch:7.4.279Scott Prager2014-08-04
| | | | | | | | | | | | | | | | Problem: globpath() returns a string, making it difficult to get a list of matches. (Greg Novack) Solution: Add an optional argument like with glob(). (Adnan Zafar) https://code.google.com/p/vim/source/detail?r=8e9db1f27a0063df023cc05a760fce73255dad24
* | clang-analyzer: Fix dead stores in garray.c.Florian Walch2014-08-07
|/
* move <inttypes.h> include out of vim.hBrandon Coleman2014-07-09
|
* Introduce GA_APPEND()Felipe Oliveira Carvalho2014-06-30
| | | | | | | | | This macro is used to append an element to a growable array. It replaces this common idiom: ga_grow(&ga, 1); ((item_type *)ga.ga_data)[ga.ga_len] = item; ++ga.ga_len;
* ga_growsize should be >= 1Felipe Oliveira Carvalho2014-06-30
| | | | | | | | | | | I know it could be 0 sometimes. Running the tests with `assert(gap->ga_growsize > 0)` in ga_grow() crashes nvim while running the tests. - Add a setter for ga_growsize that checks whether the value passed is >=1 (log in case it's not) - log when ga_grow() tries to use a ga_growsize that's not >=1 - use GA_EMPTY_INIT_VALUE is many places
* Declare garray iterators in the for() scope where possible #819Felipe Oliveira Carvalho2014-06-10
|
* Add automatic generation of headersZyX2014-06-02
| | | | | | | | | | | | | | | | | - The 'stripdecls.py' script replaces declarations in all headers by includes to generated headers. `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'` was used for this. - Add and integrate gendeclarations.lua into the build system to generate the required includes. - Add -Wno-unused-function - Made a bunch of old-style definitions ANSI This adds a requirement: all type and structure definitions must be present before INCLUDE_GENERATED_DECLARATIONS-protected include. Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is the only exception.
* Replace ga->ga_len > 0 checks with !GA_EMPTY(ga)Felipe Oliveira Carvalho2014-05-17
| | | | | | | | | | | | | | | | | | | | | | Used Coccinelle to perform the changes ```diff @@ expression E; @@ <... ( - E.ga_len > 0 + !GA_EMPTY(&E) | - E->ga_len > 0 + !GA_EMPTY(E) ) ...> ``` `spatch --in-place --sp-file ga_empty.cocci <C_FILE>`
* Introduce nvim namespace: Fix unmasked strings.h issue.Eliseo Martínez2014-05-15
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: Now that nvim/strings.h is correctly namespaced, an issue that had been masked until now arises: When compiling, we get a lot of errors because of everywhere the functions in nvim/strings.h are used, there's no include to import them. But, how could this compile and work previously, then? It turns out that: - In every such case, we are also including vim.h, which in turn includes os_unix_defs.h. - os_unix_defs.h includes <string.h> and also <strings.h> in some systems (e.g. OSX). - Build had been modified previously to (even when importing system headers), prefer equally-named local ones. That was in fact done as a previous attempt to solve the same issue we are trying to solve another way now. So, we were including our "strings.h" as a side-effect of including <strings.h> through "vim.h" --> "os_unix_defs.h". Solution: Correctly include "nvim/strings.h" in every file needing it.
* Introduce nvim namespace: Fix project-local includes.Eliseo Martínez2014-05-15
| | | | Prepend 'nvim/' in all project-local (non-system) includes.
* Introduce nvim namespace: Move files.Eliseo Martínez2014-05-15
Move files from src/ to src/nvim/. - src/nvim/ becomes the new root dir for nvim executable sources. - src/libnvim/ is planned to become root dir of the neovim library.