diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-06-16 20:27:25 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-06-16 20:27:25 -0400 |
commit | d199d18159c624844c9c8052d1a98b91084fb803 (patch) | |
tree | 827dd9c4f8f1f6ef73ff1f20a609d08e36640986 /src/nvim/misc1.c | |
parent | 8bbeb4b480a72d0099a18c4d8200313600045231 (diff) | |
parent | e85598e5a91c714c10034b6b3986a666065d1078 (diff) | |
download | rneovim-d199d18159c624844c9c8052d1a98b91084fb803.tar.gz rneovim-d199d18159c624844c9c8052d1a98b91084fb803.tar.bz2 rneovim-d199d18159c624844c9c8052d1a98b91084fb803.zip |
Merge #787 'removal of redundant OOM error handling'
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 7e6dec119b..f025ff7f65 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -24,6 +24,7 @@ #include "nvim/ex_docmd.h" #include "nvim/ex_getln.h" #include "nvim/fileio.h" +#include "nvim/func_attr.h" #include "nvim/fold.h" #include "nvim/getchar.h" #include "nvim/indent.h" @@ -2847,12 +2848,10 @@ expand_env_esc ( if (esc && var != NULL && vim_strpbrk(var, (char_u *)" \t") != NULL) { char_u *p = vim_strsave_escaped(var, (char_u *)" \t"); - if (p != NULL) { - if (mustfree) - free(var); - var = p; - mustfree = TRUE; - } + if (mustfree) + free(var); + var = p; + mustfree = TRUE; } if (var != NULL && *var != NUL @@ -3280,20 +3279,17 @@ home_replace ( /* * Like home_replace, store the replaced string in allocated memory. - * When something fails, NULL is returned. */ char_u * home_replace_save ( buf_T *buf, /* when not NULL, check for help files */ char_u *src /* input file name */ -) +) FUNC_ATTR_NONNULL_RET { - char_u *dst; - size_t len = 3; /* space for "~/" and trailing NUL */ if (src != NULL) /* just in case */ len += STRLEN(src); - dst = xmalloc(len); + char_u *dst = xmalloc(len); home_replace(buf, src, dst, (int)len, TRUE); return dst; } |