refactor: follow style guide

This commit is contained in:
dundargoc
2023-12-28 13:42:24 +01:00
committed by dundargoc
parent d634cd5b0b
commit c89292fcb7
90 changed files with 953 additions and 1121 deletions

View File

@@ -101,7 +101,7 @@ static int last_idx = 0; // index in spats[] for RE_LAST
static uint8_t lastc[2] = { NUL, NUL }; // last character searched for
static Direction lastcdir = FORWARD; // last direction of character search
static int last_t_cmd = true; // last search t_cmd
static bool last_t_cmd = true; // last search t_cmd
static char lastc_bytes[MB_MAXBYTES + 1];
static int lastc_bytelen = 1; // >1 for multi-byte char
@@ -388,7 +388,7 @@ bool pat_has_uppercase(char *pat)
magic_T magic_val = MAGIC_ON;
// get the magicness of the pattern
(void)skip_regexp_ex(pat, NUL, magic_isset(), NULL, NULL, &magic_val);
skip_regexp_ex(pat, NUL, magic_isset(), NULL, NULL, &magic_val);
while (*p != NUL) {
const int l = utfc_ptr2len(p);
@@ -436,7 +436,7 @@ int last_csearch_forward(void)
int last_csearch_until(void)
{
return last_t_cmd == true;
return last_t_cmd;
}
void set_last_csearch(int c, char *s, int len)
@@ -474,7 +474,7 @@ void reset_search_dir(void)
// Set the last search pattern. For ":let @/ =" and ShaDa file.
// Also set the saved search pattern, so that this works in an autocommand.
void set_last_search_pat(const char *s, int idx, int magic, int setlast)
void set_last_search_pat(const char *s, int idx, int magic, bool setlast)
{
free_spat(&spats[idx]);
// An empty string means that nothing should be matched.
@@ -521,7 +521,7 @@ void last_pat_prog(regmmatch_T *regmatch)
return;
}
emsg_off++; // So it doesn't beep if bad expr
(void)search_regcomp("", NULL, 0, last_idx, SEARCH_KEEP, regmatch);
search_regcomp("", NULL, 0, last_idx, SEARCH_KEEP, regmatch);
emsg_off--;
}
@@ -1495,7 +1495,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char *pat)
/// position of the character, otherwise move to just before the char.
/// Do this "cap->count1" times.
/// Return FAIL or OK.
int searchc(cmdarg_T *cap, int t_cmd)
int searchc(cmdarg_T *cap, bool t_cmd)
FUNC_ATTR_NONNULL_ALL
{
int c = cap->nchar; // char to search for
@@ -2518,7 +2518,7 @@ int current_search(int count, bool forward)
/// else from position "cur".
/// "direction" is FORWARD or BACKWARD.
/// Returns true, false or -1 for failure.
static int is_zero_width(char *pattern, int move, pos_T *cur, Direction direction)
static int is_zero_width(char *pattern, bool move, pos_T *cur, Direction direction)
{
regmmatch_T regmatch;
int result = -1;
@@ -2574,8 +2574,8 @@ static int is_zero_width(char *pattern, int move, pos_T *cur, Direction directio
return result;
}
/// return true if line 'lnum' is empty or has white chars only.
int linewhite(linenr_T lnum)
/// @return true if line 'lnum' is empty or has white chars only.
bool linewhite(linenr_T lnum)
{
char *p = skipwhite(ml_get(lnum));
return *p == NUL;
@@ -3557,7 +3557,6 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool
char *curr_fname = curbuf->b_fname;
char *prev_fname = NULL;
int depth_displayed; // For type==CHECK_PATH
int already_searched;
char *p;
bool define_matched;
regmatch_T regmatch;
@@ -3643,7 +3642,7 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool
FNAME_EXP|FNAME_INCL|FNAME_REL, 1, p_fname,
NULL);
}
already_searched = false;
bool already_searched = false;
if (new_fname != NULL) {
// Check whether we have already searched in this file
for (i = 0;; i++) {