aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-05-22 12:50:59 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-05-22 13:00:51 -0400
commite2e47803bdfd5fb40e3dbc9cdf798bb27d306c72 (patch)
tree6ff1b06b5d5fd6d3260f3a778c33cfaf03f0c295 /src/nvim/ex_docmd.c
parent0aa8b5828cc0674894681841f40c3c05bfd2f07b (diff)
parente303a11ebfc352860cce73184ece692ab4d0f01c (diff)
downloadrneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.tar.gz
rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.tar.bz2
rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.zip
Merge #708 'Remove NULL/non-NULL tests after vim_str(n)save'
- replace alloc with xmalloc
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 7007cd3e22..0ff62a3726 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -718,11 +718,6 @@ int flags;
/* 3. Make a copy of the command so we can mess with it. */
else if (cmdline_copy == NULL) {
next_cmdline = vim_strsave(next_cmdline);
- if (next_cmdline == NULL) {
- EMSG(_(e_outofmem));
- retval = FAIL;
- break;
- }
}
cmdline_copy = next_cmdline;
@@ -4296,10 +4291,6 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, long argt,
if (rep_buf == NULL) {
/* Can't replace termcodes - try using the string as is */
rep_buf = vim_strsave(rep);
-
- /* Give up if out of memory */
- if (rep_buf == NULL)
- return FAIL;
}
/* get address of growarray: global or in curbuf */
@@ -4346,8 +4337,7 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, long argt,
if (cmp != 0) {
ga_grow(gap, 1);
- if ((p = vim_strnsave(name, (int)name_len)) == NULL)
- goto fail;
+ p = vim_strnsave(name, (int)name_len);
cmd = USER_CMD_GA(gap, i);
memmove(cmd + 1, cmd, (gap->ga_len - i) * sizeof(ucmd_T));
@@ -5253,12 +5243,11 @@ static void ex_colorscheme(exarg_T *eap)
char_u *expr = vim_strsave((char_u *)"g:colors_name");
char_u *p = NULL;
- if (expr != NULL) {
- ++emsg_off;
- p = eval_to_string(expr, NULL, FALSE);
- --emsg_off;
- free(expr);
- }
+ ++emsg_off;
+ p = eval_to_string(expr, NULL, FALSE);
+ --emsg_off;
+ free(expr);
+
if (p != NULL) {
MSG(p);
free(p);
@@ -7388,6 +7377,7 @@ static void ex_normal(exarg_T *eap)
* ends with half a command.
*/
save_typeahead(&tabuf);
+ // TODO(philix): after save_typeahead() this is always TRUE
if (tabuf.typebuf_valid) {
/*
* Repeat the :normal command for each line in the range. When no
@@ -7991,8 +7981,6 @@ char_u *expand_sfile(char_u *arg)
char_u *p;
result = vim_strsave(arg);
- if (result == NULL)
- return NULL;
for (p = result; *p; ) {
if (STRNCMP(p, "<sfile>", 7) != 0)