Commit Graph

24 Commits

Author SHA1 Message Date
Matthias Beyer
f9d4c78ddc replaced vim_free() calls with free() calls 2014-05-05 18:38:52 -04:00
Justin M. Keyes
1b5217687a revert #652
reverting broad cosmetic/style change because:
- increases merge-conflicts
- increases overhead of merging upstream Vim patches
- reasons for change are ambiguous, so default to no change
2014-05-01 14:00:31 -04:00
Marco Hinz
2e4613aecc Remove NUL macro 2014-04-29 17:51:09 -03:00
Nicolas Hillegeer
852f0aaae8 garray: comment and refactor a bit more
The following functions are affected:

- ga_remove_duplicate_strings
- ga_append
2014-04-29 09:29:10 -03:00
Nicolas Hillegeer
eea98c4d3b garray: refactor and optimize ga_concat
I've checked all uses of ga_concat in the codebase:

- ex_cmds2.c
- ex_getln.c
- eval.c
- message.c
- regexp-nfa.c
- term.c
- spell.c

None of them concats the garray with itself. This makes it safe to use the
faster memcpy() instead of memmove(). This change was also documented.
2014-04-29 09:29:10 -03:00
Nicolas Hillegeer
767f0fae0b garray: make parameter of ga_concat_strings const 2014-04-29 09:29:10 -03:00
Nicolas Hillegeer
104000eff6 garray: implement ga_concat_strings_sep
A generalized version of ga_concat_strings that can handle any separator.
Reimplement ga_concat_strings on top of it.
2014-04-29 09:29:10 -03:00
Nicolas Hillegeer
cf68eda287 garray: reimplement ga_concat_strings with stpcpy
Less useless strlen(), stpcpy() is a more natural fit for this task.
ga_concat_strings() still has too much strlen() but that would be ugly to
remove for a function that's not used very often (just once in the current
codebase).
2014-04-29 09:29:10 -03:00
Nicolas Hillegeer
466b73108f garray: refactor ga_grow
- xrealloc will call xmalloc if the input pointer is NULL, no need to check
  twice.
- use the early-quit idiom to decrease the indentation, which enhances
  readability.
2014-04-29 09:29:10 -03:00
Marco Hinz
b8520b8ee4 Fix garray.* according to -Wconversion 2014-04-28 07:58:10 -03:00
Felipe Oliveira Carvalho
42f1bd9b22 No OOM error condition in ga_concat_strings(), concat_fnames(), concat_str()
- xmallocz() is not static anymore. There are many use cases for this function
	 in the codebase and we should start using it.
 - Simpler types in ga_concat_strings()
2014-04-24 10:31:31 -03:00
Felipe Oliveira Carvalho
f6b0e335e1 Remove OOM error handling code after ga_grow() calls 2014-04-11 12:57:59 -03:00
Felipe Oliveira Carvalho
13848aadbf Remove simpler cases of OOM error handling (after *alloc calls)
By simpler cases I mean cases where the OOM error is not expected to be handled
by the caller of the function that calls `alloc`, `lalloc`, `xrealloc`,
`xmalloc`, `alloc_clear`, and `lalloc_clear`.

These are the functions that:

 - Do not return an allocated buffer
 - Have OOM as the only error condition

I took note of the functions that expect the caller to handle the OOM error and
will go through them to check all the callers that may be handling OOM error in
future commits.

I'm ignoring eval.c and ex_.c in this series of commits. eval.c will soon be
obsolete and I will deal with ex_.c in later PRs.
2014-04-06 22:54:59 -03:00
John Schmidt
6f53cb1cc3 Extract memory.c from misc2.c 2014-04-04 16:33:12 -03:00
John Schmidt
5d30654512 Rename ga_init2() to ga_init() 2014-03-31 14:42:11 -03:00
John Schmidt
e02790cad4 Inline ga_init() 2014-03-31 14:42:11 -03:00
Felipe Oliveira Carvalho
0e998066b2 xrealloc(): similar to xmalloc()
Replaced all calls to realloc by xrealloc. All `== NULL` tests can be removed
and the code within `!= NULL` tests can be unwrapped.
2014-03-31 07:31:47 -03:00
John Schmidt
44e40b02cf Move remove_duplicates to garray.c 2014-03-29 13:29:53 -03:00
Felipe Oliveira Carvalho
f8432ef127 Use realloc instead of vim_realloc 2014-03-26 18:29:17 -03:00
Felipe Oliveira Carvalho
07dad7acf3 Use memmove instead of mch_memmove 2014-03-26 16:28:13 -03:00
Felipe Oliveira Carvalho
ed3e9d51ac Use memset instead of vim_memset
Ran some commands on terminal, reviewed changes, and made some manual changes
too.

    find src | xargs perl -i -p -e "s/vim_memset/memset/g"
    git grep -l memset | egrep "\.c$" | xargs perl -i -p -e \
        's/(#include "vim\.h")/#include <string.h>\n\n\1/g'
2014-03-25 18:57:02 -03:00
David Z. Chen
baab238271 Issue #311 - Clean up blowfish.c/h, charset.c/h, diff.c/h, digraph.c/h, garray.c/h, hashtab.c/h, popupmnu.c/h, sha256.c/h, version.c/h. Update uncrustify to move logical operators to the beginning of the line when splitting. Also, clean up arabic.c/h and farsi.c/h 2014-03-16 12:00:41 -03:00
Simen Endsjø
3925d951a1 Remove USE_SYSTEM and code only run under USE_SYSTEM 2014-03-05 15:12:21 -03:00
Felipe Oliveira Carvalho
410f0a27c5 Extract garray.c from misc2.c
Start to split misc2.c in many other files (see #209).
2014-02-28 06:43:20 -03:00