aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2015-01-23 14:17:33 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2015-01-27 01:33:33 +0100
commitd228b8a93e8586c36c1b1aa71d0d3dc8c52f137e (patch)
tree9f80f79c3a783c7ebdf6e94c659532626ff1aed5 /src
parentce5b476dd9aeb7c2b5094ca517ba76abe7e70a00 (diff)
downloadrneovim-d228b8a93e8586c36c1b1aa71d0d3dc8c52f137e.tar.gz
rneovim-d228b8a93e8586c36c1b1aa71d0d3dc8c52f137e.tar.bz2
rneovim-d228b8a93e8586c36c1b1aa71d0d3dc8c52f137e.zip
Remove nonnullret deadcode: vim_strsave.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/edit.c5
-rw-r--r--src/nvim/eval.c14
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/indent_c.c2
-rw-r--r--src/nvim/path.c18
-rw-r--r--src/nvim/screen.c2
6 files changed, 14 insertions, 31 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 11ff37d033..4a00a54e79 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1633,11 +1633,6 @@ change_indent (
* put it back again the way we wanted it.
*/
if (State & VREPLACE_FLAG) {
- /* If orig_line didn't allocate, just return. At least we did the job,
- * even if you can't backspace. */
- if (orig_line == NULL)
- return;
-
/* Save new line */
new_line = vim_strsave(get_cursor_line_ptr());
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 87a5ed80e7..639d406896 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -11628,18 +11628,12 @@ static void f_or(typval_T *argvars, typval_T *rettv)
*/
static void f_pathshorten(typval_T *argvars, typval_T *rettv)
{
- char_u *p;
-
rettv->v_type = VAR_STRING;
- p = get_tv_string_chk(&argvars[0]);
- if (p == NULL)
- rettv->vval.v_string = NULL;
- else {
- p = vim_strsave(p);
- rettv->vval.v_string = p;
- if (p != NULL)
- shorten_dir(p);
+ rettv->vval.v_string = get_tv_string_chk(&argvars[0]);
+ if (!rettv->vval.v_string) {
+ return;
}
+ rettv->vval.v_string = shorten_dir(vim_strsave(rettv->vval.v_string));
}
/*
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index b1a7044565..3143363af6 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -4742,7 +4742,6 @@ void ex_help(exarg_T *eap)
tag = vim_strsave(matches[i]);
FreeWild(num_matches, matches);
-
/*
* Re-use an existing help window or open a new one.
* Always open a new one for ":tab help".
@@ -4805,8 +4804,7 @@ void ex_help(exarg_T *eap)
* It is needed for do_tag top open folds under the cursor. */
KeyTyped = old_KeyTyped;
- if (tag != NULL)
- do_tag(tag, DT_HELP, 1, FALSE, TRUE);
+ do_tag(tag, DT_HELP, 1, FALSE, TRUE);
/* Delete the empty buffer if we're not using it. Careful: autocommands
* may have jumped to another window, check that the buffer is not in a
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 9c636ebbcc..8310f635c9 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -1593,8 +1593,6 @@ int get_c_indent(void)
* This is required, because only the most recent line obtained with
* ml_get is valid! */
linecopy = vim_strsave(ml_get(cur_curpos.lnum));
- if (linecopy == NULL)
- return 0;
/*
* In insert mode and the cursor is on a ')' truncate the line at the
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 219dac12de..0a19dabc01 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -239,33 +239,31 @@ int vim_ispathlistsep(int c)
* Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
* It's done in-place.
*/
-void shorten_dir(char_u *str)
+char_u *shorten_dir(char_u *str)
{
- char_u *tail, *s, *d;
- int skip = FALSE;
-
- tail = path_tail(str);
- d = str;
- for (s = str;; ++s) {
+ char_u *tail = path_tail(str);
+ char_u *d = str;
+ bool skip = false;
+ for (char_u *s = str;; ++s) {
if (s >= tail) { /* copy the whole tail */
*d++ = *s;
if (*s == NUL)
break;
} else if (vim_ispathsep(*s)) { /* copy '/' and next char */
*d++ = *s;
- skip = FALSE;
+ skip = false;
} else if (!skip) {
*d++ = *s; /* copy next char */
if (*s != '~' && *s != '.') /* and leading "~" and "." */
- skip = TRUE;
+ skip = true;
if (has_mbyte) {
int l = mb_ptr2len(s);
-
while (--l > 0)
*d++ = *++s;
}
}
}
+ return str;
}
/*
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 61aa775384..6d25c4359b 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -7795,7 +7795,7 @@ static void draw_tabline(void)
if (room > 0) {
/* Get buffer name in NameBuff[] */
get_trans_bufname(cwp->w_buffer);
- shorten_dir(NameBuff);
+ (void)shorten_dir(NameBuff);
len = vim_strsize(NameBuff);
p = NameBuff;
if (has_mbyte)