diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-03-29 01:05:04 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-31 07:31:47 -0300 |
commit | 0e998066b2533de3cf87ece1068839e60e128f1a (patch) | |
tree | 0dc09cd25ef39a59e6f9c1c41493e11bacea8f79 /src/eval.c | |
parent | 7bdd1f1898c6c94326e4642d8f51f74cc14b5f9d (diff) | |
download | rneovim-0e998066b2533de3cf87ece1068839e60e128f1a.tar.gz rneovim-0e998066b2533de3cf87ece1068839e60e128f1a.tar.bz2 rneovim-0e998066b2533de3cf87ece1068839e60e128f1a.zip |
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.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index bf208b3fde..847082aebf 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12018,7 +12018,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv) /* Change "prev" buffer to be the right size. This way * the bytes are only copied once, and very long lines are * allocated only once. */ - if ((s = realloc(prev, prevlen + len + 1)) != NULL) { + if ((s = xrealloc(prev, prevlen + len + 1)) != NULL) { memmove(s + prevlen, start, len); s[prevlen + len] = NUL; prev = NULL; /* the list will own the string */ @@ -12103,7 +12103,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv) prevsize = grow50pc > growmin ? grow50pc : growmin; } newprev = prev == NULL ? alloc(prevsize) - : realloc(prev, prevsize); + : xrealloc(prev, prevsize); if (newprev == NULL) { do_outofmem_msg((long_u)prevsize); failed = TRUE; |