Moved temporary variable to where it's used

This commit is contained in:
Shirasaka
2020-12-05 23:48:59 +09:00
parent 9601e7c5d5
commit bb6229449d

View File

@@ -3788,7 +3788,6 @@ void free_tabpage(tabpage_T *tp)
int win_new_tabpage(int after, char_u *filename) int win_new_tabpage(int after, char_u *filename)
{ {
tabpage_T *old_curtab = curtab; tabpage_T *old_curtab = curtab;
tabpage_T *tp = curtab;
tabpage_T *newtp; tabpage_T *newtp;
int n; int n;
@@ -3800,18 +3799,20 @@ int win_new_tabpage(int after, char_u *filename)
return FAIL; return FAIL;
} }
newtp->tp_localdir = tp->tp_localdir ? vim_strsave(tp->tp_localdir) : NULL; newtp->tp_localdir = old_curtab->tp_localdir ? vim_strsave(old_curtab->tp_localdir) : NULL;
curtab = newtp; curtab = newtp;
/* Create a new empty window. */ /* Create a new empty window. */
if (win_alloc_firstwin(tp->tp_curwin) == OK) { if (win_alloc_firstwin(old_curtab->tp_curwin) == OK) {
/* Make the new Tab page the new topframe. */ /* Make the new Tab page the new topframe. */
if (after == 1) { if (after == 1) {
/* New tab page becomes the first one. */ /* New tab page becomes the first one. */
newtp->tp_next = first_tabpage; newtp->tp_next = first_tabpage;
first_tabpage = newtp; first_tabpage = newtp;
} else { } else {
tabpage_T *tp = old_curtab;
if (after > 0) { if (after > 0) {
/* Put new tab page before tab page "after". */ /* Put new tab page before tab page "after". */
n = 2; n = 2;