Skip to content

Commit c1a5024

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents d1d8eb9 + 5fac467 commit c1a5024

7 files changed

Lines changed: 50 additions & 19 deletions

File tree

src/channel.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -739,10 +739,10 @@ channel_open(
739739
* After putting the socket in non-blocking mode, connect() will
740740
* return EINPROGRESS, select() will not wait (as if writing is
741741
* possible), need to use getsockopt() to check if the socket is
742-
* actually connect.
743-
* We detect an failure to connect when both read and write fds
742+
* actually able to connect.
743+
* We detect an failure to connect when either read and write fds
744744
* are set. Use getsockopt() to find out what kind of failure. */
745-
if (FD_ISSET(sd, &rfds) && FD_ISSET(sd, &wfds))
745+
if (FD_ISSET(sd, &rfds) || FD_ISSET(sd, &wfds))
746746
{
747747
ret = getsockopt(sd,
748748
SOL_SOCKET, SO_ERROR, &so_error, &so_error_len);
@@ -1535,6 +1535,9 @@ may_invoke_callback(channel_T *channel, int part)
15351535
* get everything we have. */
15361536
msg = channel_get_all(channel, part);
15371537

1538+
if (msg == NULL)
1539+
return FALSE; /* out of memory (and avoids Coverity warning) */
1540+
15381541
argv[1].v_type = VAR_STRING;
15391542
argv[1].vval.v_string = msg;
15401543
}
@@ -1570,21 +1573,22 @@ may_invoke_callback(channel_T *channel, int part)
15701573
{
15711574
if (buffer != NULL)
15721575
{
1573-
buf_T *save_curbuf = curbuf;
1574-
linenr_T lnum = buffer->b_ml.ml_line_count;
1575-
1576-
/* Append to the buffer */
1577-
ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
1578-
1579-
curbuf = buffer;
1580-
u_sync(TRUE);
1581-
u_save(lnum, lnum + 1);
1582-
15831576
if (msg == NULL)
15841577
/* JSON or JS mode: re-encode the message. */
15851578
msg = json_encode(listtv, ch_mode);
15861579
if (msg != NULL)
15871580
{
1581+
buf_T *save_curbuf = curbuf;
1582+
linenr_T lnum = buffer->b_ml.ml_line_count;
1583+
1584+
/* Append to the buffer */
1585+
ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
1586+
1587+
curbuf = buffer;
1588+
u_sync(TRUE);
1589+
/* ignore undo failure, undo is not very useful here */
1590+
ignored = u_save(lnum, lnum + 1);
1591+
15881592
ml_append(lnum, msg, 0, FALSE);
15891593
appended_lines_mark(lnum, 1L);
15901594
curbuf = save_curbuf;

src/edit.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,9 @@ ins_redraw(
15991599
curwin->w_p_cole > 0
16001600
# endif
16011601
)
1602+
# ifdef FEAT_AUTOCMD
16021603
&& !equalpos(last_cursormoved, curwin->w_cursor)
1604+
# endif
16031605
# ifdef FEAT_INS_EXPAND
16041606
&& !pum_visible()
16051607
# endif
@@ -1625,12 +1627,16 @@ ins_redraw(
16251627
# ifdef FEAT_CONCEAL
16261628
if (curwin->w_p_cole > 0)
16271629
{
1630+
# ifdef FEAT_AUTOCMD
16281631
conceal_old_cursor_line = last_cursormoved.lnum;
1632+
# endif
16291633
conceal_new_cursor_line = curwin->w_cursor.lnum;
16301634
conceal_update_lines = TRUE;
16311635
}
16321636
# endif
1637+
# ifdef FEAT_AUTOCMD
16331638
last_cursormoved = curwin->w_cursor;
1639+
# endif
16341640
}
16351641
#endif
16361642

src/eval.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3152,8 +3152,8 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
31523152
}
31533153
return OK;
31543154

3155-
#ifdef FEAT_FLOAT
31563155
case VAR_FLOAT:
3156+
#ifdef FEAT_FLOAT
31573157
{
31583158
float_T f;
31593159

@@ -3170,8 +3170,8 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
31703170
else
31713171
tv1->vval.v_float -= f;
31723172
}
3173-
return OK;
31743173
#endif
3174+
return OK;
31753175
}
31763176
}
31773177

@@ -8011,8 +8011,8 @@ tv2string(
80118011
case VAR_STRING:
80128012
*tofree = string_quote(tv->vval.v_string, FALSE);
80138013
return *tofree;
8014-
#ifdef FEAT_FLOAT
80158014
case VAR_FLOAT:
8015+
#ifdef FEAT_FLOAT
80168016
*tofree = NULL;
80178017
vim_snprintf((char *)numbuf, NUMBUFLEN - 1, "%g", tv->vval.v_float);
80188018
return numbuf;

src/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,10 @@ main_loop(
12391239
curwin->w_p_cole > 0
12401240
# endif
12411241
)
1242-
&& !equalpos(last_cursormoved, curwin->w_cursor))
1242+
# ifdef FEAT_AUTOCMD
1243+
&& !equalpos(last_cursormoved, curwin->w_cursor)
1244+
# endif
1245+
)
12431246
{
12441247
# ifdef FEAT_AUTOCMD
12451248
if (has_cursormoved())
@@ -1249,12 +1252,16 @@ main_loop(
12491252
# ifdef FEAT_CONCEAL
12501253
if (curwin->w_p_cole > 0)
12511254
{
1255+
# ifdef FEAT_AUTOCMD
12521256
conceal_old_cursor_line = last_cursormoved.lnum;
1257+
# endif
12531258
conceal_new_cursor_line = curwin->w_cursor.lnum;
12541259
conceal_update_lines = TRUE;
12551260
}
12561261
# endif
1262+
# ifdef FEAT_AUTOCMD
12571263
last_cursormoved = curwin->w_cursor;
1264+
# endif
12581265
}
12591266
#endif
12601267

src/os_unix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5257,9 +5257,9 @@ mch_clear_job(job_T *job)
52575257
{
52585258
/* call waitpid because child process may become zombie */
52595259
# ifdef __NeXT__
5260-
wait4(job->jv_pid, NULL, WNOHANG, (struct rusage *)0);
5260+
(void)wait4(job->jv_pid, NULL, WNOHANG, (struct rusage *)0);
52615261
# else
5262-
waitpid(job->jv_pid, NULL, WNOHANG);
5262+
(void)waitpid(job->jv_pid, NULL, WNOHANG);
52635263
# endif
52645264
}
52655265
#endif

src/syntax.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6342,9 +6342,11 @@ ex_ownsyntax(exarg_T *eap)
63426342
if (old_value != NULL)
63436343
old_value = vim_strsave(old_value);
63446344

6345+
#ifdef FEAT_AUTOCMD
63456346
/* Apply the "syntax" autocommand event, this finds and loads the syntax
63466347
* file. */
63476348
apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf);
6349+
#endif
63486350

63496351
/* move value of b:current_syntax to w:current_syntax */
63506352
new_value = get_var_value((char_u *)"b:current_syntax");

src/version.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,18 @@ static char *(features[]) =
758758

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
1474,
763+
/**/
764+
1473,
765+
/**/
766+
1472,
767+
/**/
768+
1471,
769+
/**/
770+
1470,
771+
/**/
772+
1469,
761773
/**/
762774
1468,
763775
/**/

0 commit comments

Comments
 (0)