summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-30 21:10:09 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-30 21:10:09 +0100
commit764b23c8fd3369cb05ae9122abf3ca16fec539d7 (patch)
tree9f9c938d8f1d4d38aae0ea514eed94c89cb1aeb8 /src/search.c
parent055409764ca5f7978d4c399d2c440af0ce971c4f (diff)
downloadvim-git-764b23c8fd3369cb05ae9122abf3ca16fec539d7.tar.gz
patch 7.4.1214v7.4.1214
Problem: Using old style function declarations. Solution: Change to new style function declarations. (script by Hirohito Higashi)
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c383
1 files changed, 169 insertions, 214 deletions
diff --git a/src/search.c b/src/search.c
index 3aa752a86..23cb2911e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -140,12 +140,12 @@ typedef struct SearchedFile
* returns FAIL if failed, OK otherwise.
*/
int
-search_regcomp(pat, pat_save, pat_use, options, regmatch)
- char_u *pat;
- int pat_save;
- int pat_use;
- int options;
- regmmatch_T *regmatch; /* return: pattern and ignore-case flag */
+search_regcomp(
+ char_u *pat,
+ int pat_save,
+ int pat_use,
+ int options,
+ regmmatch_T *regmatch) /* return: pattern and ignore-case flag */
{
int magic;
int i;
@@ -230,7 +230,7 @@ search_regcomp(pat, pat_save, pat_use, options, regmatch)
* Get search pattern used by search_regcomp().
*/
char_u *
-get_search_pat()
+get_search_pat(void)
{
return mr_pattern;
}
@@ -241,8 +241,7 @@ get_search_pat()
* Returns the allocated string, NULL when out of memory.
*/
char_u *
-reverse_text(s)
- char_u *s;
+reverse_text(char_u *s)
{
unsigned len;
unsigned s_i, rev_i;
@@ -280,10 +279,7 @@ reverse_text(s)
#endif
void
-save_re_pat(idx, pat, magic)
- int idx;
- char_u *pat;
- int magic;
+save_re_pat(int idx, char_u *pat, int magic)
{
if (spats[idx].pat != pat)
{
@@ -309,7 +305,7 @@ save_re_pat(idx, pat, magic)
static int save_level = 0;
void
-save_search_patterns()
+save_search_patterns(void)
{
if (save_level++ == 0)
{
@@ -327,7 +323,7 @@ save_search_patterns()
}
void
-restore_search_patterns()
+restore_search_patterns(void)
{
if (--save_level == 0)
{
@@ -348,7 +344,7 @@ restore_search_patterns()
#if defined(EXITFREE) || defined(PROTO)
void
-free_search_patterns()
+free_search_patterns(void)
{
vim_free(spats[0].pat);
vim_free(spats[1].pat);
@@ -369,8 +365,7 @@ free_search_patterns()
* Uses the 'ignorecase' and 'smartcase' options.
*/
int
-ignorecase(pat)
- char_u *pat;
+ignorecase(char_u *pat)
{
int ic = p_ic;
@@ -389,8 +384,7 @@ ignorecase(pat)
* Return TRUE if pattern "pat" has an uppercase character.
*/
int
-pat_has_uppercase(pat)
- char_u *pat;
+pat_has_uppercase(char_u *pat)
{
char_u *p = pat;
@@ -427,7 +421,7 @@ pat_has_uppercase(pat)
}
char_u *
-last_csearch()
+last_csearch(void)
{
#ifdef FEAT_MBYTE
return lastc_bytes;
@@ -437,22 +431,19 @@ last_csearch()
}
int
-last_csearch_forward()
+last_csearch_forward(void)
{
return lastcdir == FORWARD;
}
int
-last_csearch_until()
+last_csearch_until(void)
{
return last_t_cmd == TRUE;
}
void
-set_last_csearch(c, s, len)
- int c;
- char_u *s UNUSED;
- int len UNUSED;
+set_last_csearch(int c, char_u *s UNUSED, int len UNUSED)
{
*lastc = c;
#ifdef FEAT_MBYTE
@@ -465,21 +456,19 @@ set_last_csearch(c, s, len)
}
void
-set_csearch_direction(cdir)
- int cdir;
+set_csearch_direction(int cdir)
{
lastcdir = cdir;
}
void
-set_csearch_until(t_cmd)
- int t_cmd;
+set_csearch_until(int t_cmd)
{
last_t_cmd = t_cmd;
}
char_u *
-last_search_pat()
+last_search_pat(void)
{
return spats[last_idx].pat;
}
@@ -488,7 +477,7 @@ last_search_pat()
* Reset search direction to forward. For "gd" and "gD" commands.
*/
void
-reset_search_dir()
+reset_search_dir(void)
{
spats[0].off.dir = '/';
#if defined(FEAT_EVAL)
@@ -502,11 +491,11 @@ reset_search_dir()
* Also set the saved search pattern, so that this works in an autocommand.
*/
void
-set_last_search_pat(s, idx, magic, setlast)
- char_u *s;
- int idx;
- int magic;
- int setlast;
+set_last_search_pat(
+ char_u *s,
+ int idx,
+ int magic,
+ int setlast)
{
vim_free(spats[idx].pat);
/* An empty string means that nothing should be matched. */
@@ -550,8 +539,7 @@ set_last_search_pat(s, idx, magic, setlast)
* Values returned in regmatch->regprog and regmatch->rmm_ic.
*/
void
-last_pat_prog(regmatch)
- regmmatch_T *regmatch;
+last_pat_prog(regmmatch_T *regmatch)
{
if (spats[last_idx].pat == NULL)
{
@@ -585,18 +573,18 @@ last_pat_prog(regmatch)
* subpattern plus one; one if there was none.
*/
int
-searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
- win_T *win; /* window to search in; can be NULL for a
+searchit(
+ win_T *win, /* window to search in; can be NULL for a
buffer without a window! */
- buf_T *buf;
- pos_T *pos;
- int dir;
- char_u *pat;
- long count;
- int options;
- int pat_use; /* which pattern to use when "pat" is empty */
- linenr_T stop_lnum; /* stop after this line number when != 0 */
- proftime_T *tm UNUSED; /* timeout limit or NULL */
+ buf_T *buf,
+ pos_T *pos,
+ int dir,
+ char_u *pat,
+ long count,
+ int options,
+ int pat_use, /* which pattern to use when "pat" is empty */
+ linenr_T stop_lnum, /* stop after this line number when != 0 */
+ proftime_T *tm UNUSED) /* timeout limit or NULL */
{
int found;
linenr_T lnum; /* no init to shut up Apollo cc */
@@ -1088,14 +1076,13 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
#ifdef FEAT_EVAL
void
-set_search_direction(cdir)
- int cdir;
+set_search_direction(int cdir)
{
spats[0].off.dir = cdir;
}
static void
-set_vv_searchforward()
+set_vv_searchforward(void)
{
set_vim_var_nr(VV_SEARCHFORWARD, (long)(spats[0].off.dir == '/'));
}
@@ -1105,8 +1092,7 @@ set_vv_searchforward()
* Return zero if none of them matched.
*/
static int
-first_submatch(rp)
- regmmatch_T *rp;
+first_submatch(regmmatch_T *rp)
{
int submatch;
@@ -1146,13 +1132,13 @@ first_submatch(rp)
* Return 0 for failure, 1 for found, 2 for found and line offset added.
*/
int
-do_search(oap, dirc, pat, count, options, tm)
- oparg_T *oap; /* can be NULL */
- int dirc; /* '/' or '?' */
- char_u *pat;
- long count;
- int options;
- proftime_T *tm; /* timeout limit or NULL */
+do_search(
+ oparg_T *oap, /* can be NULL */
+ int dirc, /* '/' or '?' */
+ char_u *pat,
+ long count,
+ int options,
+ proftime_T *tm) /* timeout limit or NULL */
{
pos_T pos; /* position of the last match */
char_u *searchstr;
@@ -1536,11 +1522,11 @@ end_do_search:
* Return OK for success, or FAIL if no line found.
*/
int
-search_for_exact_line(buf, pos, dir, pat)
- buf_T *buf;
- pos_T *pos;
- int dir;
- char_u *pat;
+search_for_exact_line(
+ buf_T *buf,
+ pos_T *pos,
+ int dir,
+ char_u *pat)
{
linenr_T start = 0;
char_u *ptr;
@@ -1617,9 +1603,7 @@ search_for_exact_line(buf, pos, dir, pat)
* Return FAIL or OK.
*/
int
-searchc(cap, t_cmd)
- cmdarg_T *cap;
- int t_cmd;
+searchc(cmdarg_T *cap, int t_cmd)
{
int c = cap->nchar; /* char to search for */
int dir = cap->arg; /* TRUE for searching forward */
@@ -1754,9 +1738,7 @@ searchc(cap, t_cmd)
* Improvement over vi: Braces inside quotes are ignored.
*/
pos_T *
-findmatch(oap, initc)
- oparg_T *oap;
- int initc;
+findmatch(oparg_T *oap, int initc)
{
return findmatchlimit(oap, initc, 0, 0);
}
@@ -1769,11 +1751,11 @@ findmatch(oap, initc)
* Handles multibyte string correctly.
*/
static int
-check_prevcol(linep, col, ch, prevcol)
- char_u *linep;
- int col;
- int ch;
- int *prevcol;
+check_prevcol(
+ char_u *linep,
+ int col,
+ int ch,
+ int *prevcol)
{
--col;
#ifdef FEAT_MBYTE
@@ -1792,10 +1774,7 @@ static int find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos);
* Return TRUE if the matching end can be found between startpos and endpos.
*/
static int
-find_rawstring_end(linep, startpos, endpos)
- char_u *linep;
- pos_T *startpos;
- pos_T *endpos;
+find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos)
{
char_u *p;
char_u *delim_copy;
@@ -1854,11 +1833,11 @@ find_rawstring_end(linep, startpos, endpos)
*/
pos_T *
-findmatchlimit(oap, initc, flags, maxtravel)
- oparg_T *oap;
- int initc;
- int flags;
- int maxtravel;
+findmatchlimit(
+ oparg_T *oap,
+ int initc,
+ int flags,
+ int maxtravel)
{
static pos_T pos; /* current search position */
int findc = 0; /* matching brace */
@@ -2504,8 +2483,7 @@ findmatchlimit(oap, initc, flags, maxtravel)
* TODO: skip strings.
*/
static int
-check_linecomment(line)
- char_u *line;
+check_linecomment(char_u *line)
{
char_u *p;
@@ -2565,8 +2543,8 @@ check_linecomment(line)
* If there isn't a match, then beep.
*/
void
-showmatch(c)
- int c; /* char to show match for */
+showmatch(
+ int c) /* char to show match for */
{
pos_T *lpos, save_cursor;
pos_T mpos;
@@ -2672,9 +2650,7 @@ showmatch(c)
* Return OK if the next sentence was found.
*/
int
-findsent(dir, count)
- int dir;
- long count;
+findsent(int dir, long count)
{
pos_T pos, tpos;
int c;
@@ -2801,12 +2777,12 @@ found:
* Return TRUE if the next paragraph or section was found.
*/
int
-findpar(pincl, dir, count, what, both)
- int *pincl; /* Return: TRUE if last char is to be included */
- int dir;
- long count;
- int what;
- int both;
+findpar(
+ int *pincl, /* Return: TRUE if last char is to be included */
+ int dir,
+ long count,
+ int what,
+ int both)
{
linenr_T curr;
int did_skip; /* TRUE after separating lines have been skipped */
@@ -2880,9 +2856,7 @@ findpar(pincl, dir, count, what, both)
* check if the string 's' is a nroff macro that is in option 'opt'
*/
static int
-inmacro(opt, s)
- char_u *opt;
- char_u *s;
+inmacro(char_u *opt, char_u *s)
{
char_u *macro;
@@ -2911,10 +2885,7 @@ inmacro(opt, s)
* If 'both' is TRUE also stop at '}'
*/
int
-startPS(lnum, para, both)
- linenr_T lnum;
- int para;
- int both;
+startPS(linenr_T lnum, int para, int both)
{
char_u *s;
@@ -2953,7 +2924,7 @@ static int cls_bigword; /* TRUE for "W", "B" or "E" */
* boundaries are of interest.
*/
static int
-cls()
+cls(void)
{
int c;
@@ -3000,10 +2971,10 @@ cls()
* If eol is TRUE, last word stops at end of line (for operators).
*/
int
-fwd_word(count, bigword, eol)
- long count;
- int bigword; /* "W", "E" or "B" */
- int eol;
+fwd_word(
+ long count,
+ int bigword, /* "W", "E" or "B" */
+ int eol)
{
int sclass; /* starting class */
int i;
@@ -3072,10 +3043,7 @@ fwd_word(count, bigword, eol)
* Returns FAIL if top of the file was reached.
*/
int
-bck_word(count, bigword, stop)
- long count;
- int bigword;
- int stop;
+bck_word(long count, int bigword, int stop)
{
int sclass; /* starting class */
@@ -3140,11 +3108,11 @@ finished:
* If empty is TRUE stop on an empty line.
*/
int
-end_word(count, bigword, stop, empty)
- long count;
- int bigword;
- int stop;
- int empty;
+end_word(
+ long count,
+ int bigword,
+ int stop,
+ int empty)
{
int sclass; /* starting class */
@@ -3210,10 +3178,10 @@ finished:
* Returns FAIL if start of the file was reached.
*/
int
-bckend_word(count, bigword, eol)
- long count;
- int bigword; /* TRUE for "B" */
- int eol; /* TRUE: stop at end of line. */
+bckend_word(
+ long count,
+ int bigword, /* TRUE for "B" */
+ int eol) /* TRUE: stop at end of line. */
{
int sclass; /* starting class */
int i;
@@ -3259,9 +3227,7 @@ bckend_word(count, bigword, eol)
* Return TRUE when end-of-file reached, FALSE otherwise.
*/
static int
-skip_chars(cclass, dir)
- int cclass;
- int dir;
+skip_chars(int cclass, int dir)
{
while (cls() == cclass)
if ((dir == FORWARD ? inc_cursor() : dec_cursor()) == -1)
@@ -3274,7 +3240,7 @@ skip_chars(cclass, dir)
* Go back to the start of the word or the start of white space
*/
static void
-back_in_line()
+back_in_line(void)
{
int sclass; /* starting class */
@@ -3293,8 +3259,7 @@ back_in_line()
}
static void
-find_first_blank(posp)
- pos_T *posp;
+find_first_blank(pos_T *posp)
{
int c;
@@ -3313,9 +3278,9 @@ find_first_blank(posp)
* Skip count/2 sentences and count/2 separating white spaces.
*/
static void
-findsent_forward(count, at_start_sent)
- long count;
- int at_start_sent; /* cursor is at start of sentence */
+findsent_forward(
+ long count,
+ int at_start_sent) /* cursor is at start of sentence */
{
while (count--)
{
@@ -3333,11 +3298,11 @@ findsent_forward(count, at_start_sent)
* Used while an operator is pending, and in Visual mode.
*/
int
-current_word(oap, count, include, bigword)
- oparg_T *oap;
- long count;
- int include; /* TRUE: include word and white space */
- int bigword; /* FALSE == word, TRUE == WORD */
+current_word(
+ oparg_T *oap,
+ long count,
+ int include, /* TRUE: include word and white space */
+ int bigword) /* FALSE == word, TRUE == WORD */
{
pos_T start_pos;
pos_T pos;
@@ -3507,10 +3472,7 @@ current_word(oap, count, include, bigword)
* When Visual active, extend it by one or more sentences.
*/
int
-current_sent(oap, count, include)
- oparg_T *oap;
- long count;
- int include;
+current_sent(oparg_T *oap, long count, int include)
{
pos_T start_pos;
pos_T pos;
@@ -3687,12 +3649,12 @@ extend:
* "what" and "other" are two matching parenthesis/brace/etc.
*/
int
-current_block(oap, count, include, what, other)
- oparg_T *oap;
- long count;
- int include; /* TRUE == include white space */
- int what; /* '(', '{', etc. */
- int other; /* ')', '}', etc. */
+current_block(
+ oparg_T *oap,
+ long count,
+ int include, /* TRUE == include white space */
+ int what, /* '(', '{', etc. */
+ int other) /* ')', '}', etc. */
{
pos_T old_pos;
pos_T *pos = NULL;
@@ -3838,8 +3800,8 @@ static int in_html_tag(int);
* When "end_tag" is TRUE return TRUE if the cursor is on "</aaa>".
*/
static int
-in_html_tag(end_tag)
- int end_tag;
+in_html_tag(
+ int end_tag)
{
char_u *line = ml_get_curline();
char_u *p;
@@ -3911,10 +3873,10 @@ in_html_tag(end_tag)
* Find tag block under the cursor, cursor at end.
*/
int
-current_tagblock(oap, count_arg, include)
- oparg_T *oap;
- long count_arg;
- int include; /* TRUE == include white space */
+current_tagblock(
+ oparg_T *oap,
+ long count_arg,
+ int include) /* TRUE == include white space */
{
long count = count_arg;
long n;
@@ -4117,11 +4079,11 @@ theend:
}
int
-current_par(oap, count, include, type)
- oparg_T *oap;
- long count;
- int include; /* TRUE == include white space */
- int type; /* 'p' for paragraph, 'S' for section */
+current_par(
+ oparg_T *oap,
+ long count,
+ int include, /* TRUE == include white space */
+ int type) /* 'p' for paragraph, 'S' for section */
{
linenr_T start_lnum;
linenr_T end_lnum;
@@ -4296,11 +4258,11 @@ static int find_prev_quote(char_u *line, int col_start, int quotechar, char_u *e
* Returns column number of "quotechar" or -1 when not found.
*/
static int
-find_next_quote(line, col, quotechar, escape)
- char_u *line;
- int col;
- int quotechar;
- char_u *escape; /* escape characters, can be NULL */
+find_next_quote(
+ char_u *line,
+ int col,
+ int quotechar,
+ char_u *escape) /* escape characters, can be NULL */
{
int c;
@@ -4330,11 +4292,11 @@ find_next_quote(line, col, quotechar, escape)
* Return the found column or zero.
*/
static int
-find_prev_quote(line, col_start, quotechar, escape)
- char_u *line;
- int col_start;
- int quotechar;
- char_u *escape; /* escape characters, can be NULL */
+find_prev_quote(
+ char_u *line,
+ int col_start,
+ int quotechar,
+ char_u *escape) /* escape characters, can be NULL */
{
int n;
@@ -4362,11 +4324,11 @@ find_prev_quote(line, col_start, quotechar, escape)
* Returns TRUE if found, else FALSE.
*/
int
-current_quote(oap, count, include, quotechar)
- oparg_T *oap;
- long count;
- int include; /* TRUE == include quote char */
- int quotechar; /* Quote character */
+current_quote(
+ oparg_T *oap,
+ long count,
+ int include, /* TRUE == include quote char */
+ int quotechar) /* Quote character */
{
char_u *line = ml_get_curline();
int col_end;
@@ -4605,9 +4567,9 @@ static int is_one_char(char_u *pattern, int move);
* Used while an operator is pending, and in Visual mode.
*/
int
-current_search(count, forward)
- long count;
- int forward; /* move forward or backwards */
+current_search(
+ long count,
+ int forward) /* move forward or backwards */
{
pos_T start_pos; /* position before the pattern */
pos_T orig_pos; /* position of the cursor at beginning */
@@ -4764,9 +4726,7 @@ current_search(count, forward)
* Returns TRUE, FALSE or -1 for failure.
*/
static int
-is_one_char(pattern, move)
- char_u *pattern;
- int move;
+is_one_char(char_u *pattern, int move)
{
regmmatch_T regmatch;
int nmatched = 0;
@@ -4818,8 +4778,7 @@ is_one_char(pattern, move)
* return TRUE if line 'lnum' is empty or has white chars only.
*/
int
-linewhite(lnum)
- linenr_T lnum;
+linewhite(linenr_T lnum)
{
char_u *p;
@@ -4834,19 +4793,18 @@ linewhite(lnum)
* If p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase.
*/
void
-find_pattern_in_path(ptr, dir, len, whole, skip_comments,
- type, count, action, start_lnum, end_lnum)
- char_u *ptr; /* pointer to search pattern */
- int dir UNUSED; /* direction of expansion */
- int len; /* length of search pattern */
- int whole; /* match whole words only */
- int skip_comments; /* don't match inside comments */
- int type; /* Type of search; are we looking for a type?
+find_pattern_in_path(
+ char_u *ptr, /* pointer to search pattern */
+ int dir UNUSED, /* direction of expansion */
+ int len, /* length of search pattern */
+ int whole, /* match whole words only */
+ int skip_comments, /* don't match inside comments */
+ int type, /* Type of search; are we looking for a type?
a macro? */
- long count;
- int action; /* What to do when we find it */
- linenr_T start_lnum; /* first line to start searching */
- linenr_T end_lnum; /* last line for searching */
+ long count,
+ int action, /* What to do when we find it */
+ linenr_T start_lnum, /* first line to start searching */
+ linenr_T end_lnum) /* last line for searching */
{
SearchedFile *files; /* Stack of included files */
SearchedFile *bigger; /* When we need more space */
@@ -5543,14 +5501,14 @@ fpip_end:
}
static void
-show_pat_in_path(line, type, did_show, action, fp, lnum, count)
- char_u *line;
- int type;
- int did_show;
- int action;
- FILE *fp;
- linenr_T *lnum;
- long count;
+show_pat_in_path(
+ char_u *line,
+ int type,
+ int did_show,
+ int action,
+ FILE *fp,
+ linenr_T *lnum,
+ long count)
{
char_u *p;
@@ -5607,9 +5565,7 @@ show_pat_in_path(line, type, did_show, action, fp, lnum, count)
#ifdef FEAT_VIMINFO
int
-read_viminfo_search_pattern(virp, force)
- vir_T *virp;
- int force;
+read_viminfo_search_pattern(vir_T *virp, int force)
{
char_u *lp;
int idx = -1;
@@ -5695,8 +5651,7 @@ read_viminfo_search_pattern(virp, force)
}
void
-write_viminfo_search_pattern(fp)
- FILE *fp;
+write_viminfo_search_pattern(FILE *fp)
{
if (get_viminfo_parameter('/') != 0)
{
@@ -5710,11 +5665,11 @@ write_viminfo_search_pattern(fp)
}
static void
-wvsp_one(fp, idx, s, sc)
- FILE *fp; /* file to write to */
- int idx; /* spats[] index */
- char *s; /* search pat */
- int sc; /* dir char */
+wvsp_one(
+ FILE *fp, /* file to write to */
+ int idx, /* spats[] index */
+ char *s, /* search pat */
+ int sc) /* dir char */
{
if (spats[idx].pat != NULL)
{