comparison src/channel.c @ 8356:e0d576743e4f v7.4.1470

commit https://github.com/vim/vim/commit/289a90551d185c307abd4cfe6baadea8990d956b Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 2 21:09:32 2016 +0100 patch 7.4.1470 Problem: Coverity reports missing restore. Solution: Move json_encode() call up.
author Christian Brabandt <cb@256bit.org>
date Wed, 02 Mar 2016 21:15:05 +0100
parents b151c3f9be72
children 49d0e094cb93
comparison
equal deleted inserted replaced
8355:306724b3a93e 8356:e0d576743e4f
1549 } 1549 }
1550 else if (callback != NULL || buffer != NULL) 1550 else if (callback != NULL || buffer != NULL)
1551 { 1551 {
1552 if (buffer != NULL) 1552 if (buffer != NULL)
1553 { 1553 {
1554 buf_T *save_curbuf = curbuf;
1555 linenr_T lnum = buffer->b_ml.ml_line_count;
1556
1557 /* Append to the buffer */
1558 ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
1559
1560 curbuf = buffer;
1561 u_sync(TRUE);
1562 /* ignore undo failure, undo is not very useful here */
1563 ignored = u_save(lnum, lnum + 1);
1564
1565 if (msg == NULL) 1554 if (msg == NULL)
1566 /* JSON or JS mode: re-encode the message. */ 1555 /* JSON or JS mode: re-encode the message. */
1567 msg = json_encode(listtv, ch_mode); 1556 msg = json_encode(listtv, ch_mode);
1568 if (msg != NULL) 1557 if (msg != NULL)
1569 { 1558 {
1559 buf_T *save_curbuf = curbuf;
1560 linenr_T lnum = buffer->b_ml.ml_line_count;
1561
1562 /* Append to the buffer */
1563 ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
1564
1565 curbuf = buffer;
1566 u_sync(TRUE);
1567 /* ignore undo failure, undo is not very useful here */
1568 ignored = u_save(lnum, lnum + 1);
1569
1570 ml_append(lnum, msg, 0, FALSE); 1570 ml_append(lnum, msg, 0, FALSE);
1571 appended_lines_mark(lnum, 1L); 1571 appended_lines_mark(lnum, 1L);
1572 curbuf = save_curbuf; 1572 curbuf = save_curbuf;
1573 1573
1574 if (buffer->b_nwindows > 0) 1574 if (buffer->b_nwindows > 0)