diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-12 16:19:50 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-19 14:50:26 -0300 |
commit | e303a11ebfc352860cce73184ece692ab4d0f01c (patch) | |
tree | 67a3e4b7a8d6633149f9d22f3f51cd96498aacd4 /src/nvim/term.c | |
parent | 7a830d945fb44a850b7cef65971f37a570a36e9e (diff) | |
download | rneovim-e303a11ebfc352860cce73184ece692ab4d0f01c.tar.gz rneovim-e303a11ebfc352860cce73184ece692ab4d0f01c.tar.bz2 rneovim-e303a11ebfc352860cce73184ece692ab4d0f01c.zip |
Remove OOM checks: suggested changes in review
- Replace a vim_strsave/free pair with xrealloc
- Use xmallocz() in some places
- Use xrealloc() and forget about the NULL pointer case
- Remove invalid comment
- Remove unnecessary checks
- Replace a complicated xmalloc/STRCPY/free code chunk code with xrealloc()
- Replace a vim_strsave/free code chunk with xrealloc()
Diffstat (limited to 'src/nvim/term.c')
-rw-r--r-- | src/nvim/term.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/nvim/term.c b/src/nvim/term.c index 733bef8b5f..073ed30052 100644 --- a/src/nvim/term.c +++ b/src/nvim/term.c @@ -4304,14 +4304,9 @@ replace_termcodes ( } result[dlen] = NUL; - /* - * Copy the new string to allocated memory. - * If this fails, just return from. - */ - *bufp = vim_strsave(result); - from = *bufp; - free(result); - return from; + *bufp = xrealloc(result, dlen + 1); + + return *bufp; } /* |