diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-08 21:34:46 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-19 14:50:23 -0300 |
commit | a80d7e86c1f088c5b68d8e8929cc72a0d9680f76 (patch) | |
tree | cc9cc71ee35fe966779cf6764bd5faabd1186df3 /src/nvim/path.c | |
parent | b63d2626ed9e3e38a485b9990a8e65ba59d6906a (diff) | |
download | rneovim-a80d7e86c1f088c5b68d8e8929cc72a0d9680f76.tar.gz rneovim-a80d7e86c1f088c5b68d8e8929cc72a0d9680f76.tar.bz2 rneovim-a80d7e86c1f088c5b68d8e8929cc72a0d9680f76.zip |
Remove NULL/non-NULL tests after calls to vim_str(n)save()
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r-- | src/nvim/path.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index 7a3c644499..852ac62d71 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -296,7 +296,7 @@ void add_pathsep(char_u *p) /* * FullName_save - Make an allocated copy of a full file name. - * Returns NULL when out of memory. + * Returns NULL when fname is NULL. */ char_u * FullName_save ( @@ -305,20 +305,19 @@ FullName_save ( * like a full path name */ ) { - char_u *buf; char_u *new_fname = NULL; if (fname == NULL) return NULL; - buf = alloc((unsigned)MAXPATHL); - if (buf != NULL) { - if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) - new_fname = vim_strsave(buf); - else - new_fname = vim_strsave(fname); - free(buf); - } + char_u *buf = xmalloc(MAXPATHL); + + if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) + new_fname = vim_strsave(buf); + else + new_fname = vim_strsave(fname); + free(buf); + return new_fname; } @@ -650,8 +649,6 @@ static void expand_path_option(char_u *curdir, garray_T *gap) ga_grow(gap, 1); p = vim_strsave(buf); - if (p == NULL) - break; ((char_u **)gap->ga_data)[gap->ga_len++] = p; } @@ -1137,8 +1134,6 @@ expand_backtick ( /* Create the command: lop off the backticks. */ cmd = vim_strnsave(pat + 1, (int)STRLEN(pat) - 2); - if (cmd == NULL) - return 0; if (*cmd == '=') /* `={expr}`: Expand expression */ buffer = eval_to_string(cmd + 1, &p, TRUE); @@ -1563,9 +1558,7 @@ char_u *fix_fname(char_u *fname) fname = vim_strsave(fname); # ifdef USE_FNAME_CASE - if (fname != NULL) { - fname_case(fname, 0); /* set correct case for file name */ - } + fname_case(fname, 0); // set correct case for file name # endif return fname; |