Fix linting errors.

This commit is contained in:
Johan Klokkhammer Helsing
2015-11-04 02:44:45 +01:00
parent c3ac16cfeb
commit ad34a376eb
3 changed files with 54 additions and 58 deletions

View File

@@ -6589,7 +6589,7 @@ void fixthisline(IndentGetter get_the_indent)
if (amount >= 0) { if (amount >= 0) {
change_indent(INDENT_SET, amount, false, 0, true); change_indent(INDENT_SET, amount, false, 0, true);
if (linewhite(curwin->w_cursor.lnum)) { if (linewhite(curwin->w_cursor.lnum)) {
did_ai = TRUE; // delete the indent if the line stays empty did_ai = true; // delete the indent if the line stays empty
} }
} }
} }

View File

@@ -78,8 +78,8 @@ find_start_comment ( /* XXX */
*/ */
static pos_T *ind_find_start_CORS(void) static pos_T *ind_find_start_CORS(void)
{ /* XXX */ { /* XXX */
pos_T *comment_pos = find_start_comment(curbuf->b_ind_maxcomment); pos_T *comment_pos = find_start_comment(curbuf->b_ind_maxcomment);
pos_T *rs_pos = find_start_rawstring(curbuf->b_ind_maxcomment); pos_T *rs_pos = find_start_rawstring(curbuf->b_ind_maxcomment);
/* If comment_pos is before rs_pos the raw string is inside the comment. /* If comment_pos is before rs_pos the raw string is inside the comment.
* If rs_pos is before comment_pos the comment is inside the raw string. */ * If rs_pos is before comment_pos the comment is inside the raw string. */
@@ -95,9 +95,9 @@ static pos_T *ind_find_start_CORS(void)
*/ */
static pos_T *find_start_rawstring(int ind_maxcomment) static pos_T *find_start_rawstring(int ind_maxcomment)
{ /* XXX */ { /* XXX */
pos_T *pos; pos_T *pos;
char_u *line; char_u *line;
char_u *p; char_u *p;
long cur_maxcomment = ind_maxcomment; long cur_maxcomment = ind_maxcomment;
for (;;) for (;;)
@@ -159,9 +159,7 @@ static char_u *skip_string(char_u *p)
} }
if (p[0] == '"') if (p[0] == '"')
continue; /* continue for another string */ continue; /* continue for another string */
} } else if (p[0] == 'R' && p[1] == '"') {
else if (p[0] == 'R' && p[1] == '"')
{
/* Raw string: R"[delim](...)[delim]" */ /* Raw string: R"[delim](...)[delim]" */
char_u *delim = p + 2; char_u *delim = p + 2;
char_u *paren = vim_strchr(delim, '('); char_u *paren = vim_strchr(delim, '(');
@@ -1748,7 +1746,7 @@ int get_c_indent(void)
/* /*
* #defines and so on always go at the left when included in 'cinkeys'. * #defines and so on always go at the left when included in 'cinkeys'.
*/ */
if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', TRUE))) { if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', true))) {
amount = curbuf->b_ind_hash_comment; amount = curbuf->b_ind_hash_comment;
goto theend; goto theend;
} }
@@ -1842,12 +1840,12 @@ int get_c_indent(void)
lead_middle_len) == 0) { lead_middle_len) == 0) {
amount = get_indent_lnum(curwin->w_cursor.lnum - 1); amount = get_indent_lnum(curwin->w_cursor.lnum - 1);
break; break;
} } else if (STRNCMP(ml_get(comment_pos->lnum) + comment_pos->col,
/* If the start comment string doesn't match with the lead_start, lead_start_len) != 0) {
* start of the comment, skip this entry. XXX */ /* If the start comment string doesn't match with the
else if (STRNCMP(ml_get(comment_pos->lnum) + comment_pos->col, * start of the comment, skip this entry. XXX */
lead_start, lead_start_len) != 0)
continue; continue;
}
} }
if (start_off != 0) if (start_off != 0)
amount += start_off; amount += start_off;
@@ -3201,11 +3199,11 @@ term_again:
// basically just match where the previous line is, except // basically just match where the previous line is, except
// for the lines immediately following a function declaration, // for the lines immediately following a function declaration,
// which are K&R-style parameters and need to be indented. // which are K&R-style parameters and need to be indented.
// if our line starts with an open brace, forget about any // if our line starts with an open brace, forget about any
// prevailing indent and make sure it looks like the start // prevailing indent and make sure it looks like the start
// of a function // of a function
if (theline[0] == '{') { if (theline[0] == '{') {
amount = curbuf->b_ind_first_open; amount = curbuf->b_ind_first_open;
goto theend; goto theend;
@@ -3225,7 +3223,7 @@ term_again:
&& !cin_ends_in(theline, (char_u *)",", NULL) && !cin_ends_in(theline, (char_u *)",", NULL)
&& cin_isfuncdecl(NULL, cur_curpos.lnum + 1, && cin_isfuncdecl(NULL, cur_curpos.lnum + 1,
cur_curpos.lnum + 1) cur_curpos.lnum + 1)
&& !cin_isterminated(theline, FALSE, TRUE)) { && !cin_isterminated(theline, false, true)) {
amount = curbuf->b_ind_func_type; amount = curbuf->b_ind_func_type;
goto theend; goto theend;
} }
@@ -3253,7 +3251,7 @@ term_again:
* Are we at the start of a cpp base class declaration or * Are we at the start of a cpp base class declaration or
* constructor initialization? * constructor initialization?
*/ /* XXX */ */ /* XXX */
n = FALSE; n = false;
if (curbuf->b_ind_cpp_baseclass != 0 && theline[0] != '{') { if (curbuf->b_ind_cpp_baseclass != 0 && theline[0] != '{') {
n = cin_is_cpp_baseclass(&cache_cpp_baseclass); n = cin_is_cpp_baseclass(&cache_cpp_baseclass);
l = get_cursor_line_ptr(); l = get_cursor_line_ptr();

View File

@@ -1448,39 +1448,39 @@ static int check_prevcol(char_u *linep, int col, int ch, int *prevcol)
*/ */
static int find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos) static int find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos)
{ {
char_u *p; char_u *p;
char_u *delim_copy; char_u *delim_copy;
size_t delim_len; size_t delim_len;
linenr_T lnum; linenr_T lnum;
int found = FALSE; int found = false;
for (p = linep + startpos->col + 1; *p && *p != '('; ++p) for (p = linep + startpos->col + 1; *p && *p != '('; ++p) {}
;
delim_len = (p - linep) - startpos->col - 1; delim_len = (p - linep) - startpos->col - 1;
delim_copy = vim_strnsave(linep + startpos->col + 1, delim_len); delim_copy = vim_strnsave(linep + startpos->col + 1, delim_len);
if (delim_copy == NULL) if (delim_copy == NULL)
return FALSE; return false;
for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum) for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum)
{
char_u *line = ml_get(lnum);
for (p = line + (lnum == startpos->lnum
? startpos->col + 1 : 0); *p; ++p)
{ {
char_u *line = ml_get(lnum); if (lnum == endpos->lnum && (colnr_T)(p - line) >= endpos->col)
break;
for (p = line + (lnum == startpos->lnum if (*p == ')' && p[delim_len + 1] == '"'
? startpos->col + 1 : 0); *p; ++p) && STRNCMP(delim_copy, p + 1, delim_len) == 0)
{ {
if (lnum == endpos->lnum && (colnr_T)(p - line) >= endpos->col) found = true;
break; break;
if (*p == ')' && p[delim_len + 1] == '"' }
&& STRNCMP(delim_copy, p + 1, delim_len) == 0)
{
found = TRUE;
break;
}
}
if (found)
break;
} }
xfree(delim_copy); if (found)
return found; break;
}
xfree(delim_copy);
return found;
} }
/* /*
@@ -1510,9 +1510,9 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
int findc = 0; /* matching brace */ int findc = 0; /* matching brace */
int c; int c;
int count = 0; /* cumulative number of braces */ int count = 0; /* cumulative number of braces */
int backwards = FALSE; /* init for gcc */ int backwards = false; /* init for gcc */
int raw_string = FALSE; /* search for raw string */ int raw_string = false; /* search for raw string */
int inquote = FALSE; /* TRUE when inside quotes */ int inquote = false; /* true when inside quotes */
char_u *linep; /* pointer to current line */ char_u *linep; /* pointer to current line */
char_u *ptr; char_u *ptr;
int do_quotes; /* check for quotes in current line */ int do_quotes; /* check for quotes in current line */
@@ -1555,16 +1555,15 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
if (initc == '/' || initc == '*' || initc == 'R') { if (initc == '/' || initc == '*' || initc == 'R') {
comment_dir = dir; comment_dir = dir;
if (initc == '/') if (initc == '/')
ignore_cend = TRUE; ignore_cend = true;
backwards = (dir == FORWARD) ? FALSE : TRUE; backwards = (dir == FORWARD) ? false : true;
raw_string = (initc == 'R'); raw_string = (initc == 'R');
initc = NUL; initc = NUL;
} else if (initc != '#' && initc != NUL) { } else if (initc != '#' && initc != NUL) {
find_mps_values(&initc, &findc, &backwards, TRUE); find_mps_values(&initc, &findc, &backwards, TRUE);
if (findc == NUL) if (findc == NUL)
return NULL; return NULL;
} } else {
else {
/* /*
* Either initc is '#', or no initc was given and we need to look * Either initc is '#', or no initc was given and we need to look
* under the cursor. * under the cursor.
@@ -1832,8 +1831,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
} }
linep = ml_get(pos.lnum); /* may have been released */ linep = ml_get(pos.lnum); /* may have been released */
} }
} } else if ( linep[pos.col - 1] == '/'
else if ( linep[pos.col - 1] == '/'
&& linep[pos.col] == '*' && linep[pos.col] == '*'
&& (int)pos.col < comment_col) { && (int)pos.col < comment_col) {
count++; count++;