Fix clint issues

This commit is contained in:
Marco Hinz 2017-01-09 20:49:47 +01:00 committed by James McCoy
parent d3f97232e8
commit b0cf071d43
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
5 changed files with 24 additions and 19 deletions

View File

@ -274,7 +274,8 @@ open_buffer (
///
/// @param bufref Reference to be used for the buffer.
/// @param buf The buffer to reference.
void set_bufref(bufref_T *bufref, buf_T *buf) {
void set_bufref(bufref_T *bufref, buf_T *buf)
{
bufref->br_buf = buf;
bufref->br_buf_free_count = buf_free_count;
}
@ -284,7 +285,8 @@ void set_bufref(bufref_T *bufref, buf_T *buf) {
/// Only goes through the buffer list if buf_free_count changed.
///
/// @param bufref Buffer reference to check for.
bool bufref_valid(bufref_T *bufref) {
bool bufref_valid(bufref_T *bufref)
{
return bufref->br_buf_free_count == buf_free_count
? true
: buf_valid(bufref->br_buf);

View File

@ -5127,11 +5127,13 @@ void buf_reload(buf_T *buf, int orig_mode)
EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname);
}
if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf) {
/* Put the text back from the save buffer. First
* delete any lines that readfile() added. */
while (!bufempty())
if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL)
// Put the text back from the save buffer. First
// delete any lines that readfile() added.
while (!bufempty()) {
if (ml_delete(buf->b_ml.ml_line_count, false) == FAIL) {
break;
}
}
(void)move_lines(savebuf, buf);
}
} else if (buf == curbuf) { /* "buf" still valid */
@ -6329,9 +6331,10 @@ void ex_doautoall(exarg_T *eap)
/* restore the current window */
aucmd_restbuf(&aco);
/* stop if there is some error or buffer was deleted */
if (retval == FAIL || !bufref_valid(&bufref))
// Stop if there is some error or buffer was deleted.
if (retval == FAIL || !bufref_valid(&bufref)) {
break;
}
}
check_cursor(); /* just in case lines got deleted */

View File

@ -19,12 +19,12 @@
* not the current buffer.
*/
typedef struct {
buf_T *save_curbuf; /* saved curbuf */
int use_aucmd_win; /* using aucmd_win */
win_T *save_curwin; /* saved curwin */
win_T *new_curwin; /* new curwin */
bufref_T new_curbuf; /* new curbuf */
char_u *globaldir; /* saved value of globaldir */
buf_T *save_curbuf; ///< saved curbuf
int use_aucmd_win; ///< using aucmd_win
win_T *save_curwin; ///< saved curwin
win_T *new_curwin; ///< new curwin
bufref_T new_curbuf; ///< new curbuf
char_u *globaldir; ///< saved value of globaldir
} aco_save_T;
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -3736,7 +3736,7 @@ load_dummy_buffer (
buf_T *newbuf;
bufref_T newbufref;
bufref_T newbuf_to_wipe;
int failed = TRUE;
int failed = true;
aco_save_T aco;
// Allocate a buffer without putting it in the buffer list.

View File

@ -5411,10 +5411,10 @@ void switch_buffer(bufref_T *save_curbuf, buf_T *buf)
{
block_autocmds();
set_bufref(save_curbuf, curbuf);
--curbuf->b_nwindows;
curbuf->b_nwindows--;
curbuf = buf;
curwin->w_buffer = buf;
++curbuf->b_nwindows;
curbuf->b_nwindows++;
}
/// Restore the current buffer after using switch_buffer().
@ -5423,10 +5423,10 @@ void restore_buffer(bufref_T *save_curbuf)
unblock_autocmds();
// Check for valid buffer, just in case.
if (bufref_valid(save_curbuf)) {
--curbuf->b_nwindows;
curbuf->b_nwindows--;
curwin->w_buffer = save_curbuf->br_buf;
curbuf = save_curbuf->br_buf;
++curbuf->b_nwindows;
curbuf->b_nwindows++;
}
}