mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Remove nonnullret deadcode: vim_strsave.
This commit is contained in:
parent
ce5b476dd9
commit
d228b8a93e
@ -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());
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user