summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2010-07-04 00:50:25 -0700
committerDan Nicolaescu <dann@ics.uci.edu>2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/search.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c107
1 files changed, 28 insertions, 79 deletions
diff --git a/src/search.c b/src/search.c
index 69db94e9f1a..004e65e7715 100644
--- a/src/search.c
+++ b/src/search.c
@@ -110,10 +110,10 @@ static EMACS_INT boyer_moore (int, unsigned char *, int, int,
static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT,
EMACS_INT, EMACS_INT, int, int,
Lisp_Object, Lisp_Object, int);
-static void matcher_overflow () NO_RETURN;
+static void matcher_overflow (void) NO_RETURN;
static void
-matcher_overflow ()
+matcher_overflow (void)
{
error ("Stack overflow in regexp matcher");
}
@@ -132,12 +132,7 @@ matcher_overflow ()
The behavior also depends on Vsearch_spaces_regexp. */
static void
-compile_pattern_1 (cp, pattern, translate, regp, posix)
- struct regexp_cache *cp;
- Lisp_Object pattern;
- Lisp_Object translate;
- struct re_registers *regp;
- int posix;
+compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, struct re_registers *regp, int posix)
{
char *val;
reg_syntax_t old;
@@ -187,7 +182,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix)
This is called from garbage collection. */
void
-shrink_regexp_cache ()
+shrink_regexp_cache (void)
{
struct regexp_cache *cp;
@@ -205,7 +200,7 @@ shrink_regexp_cache ()
automagically manages the memory in each re_pattern_buffer struct,
based on its `allocated' and `buffer' values. */
void
-clear_regexp_cache ()
+clear_regexp_cache (void)
{
int i;
@@ -229,11 +224,7 @@ clear_regexp_cache ()
for this pattern. 0 means backtrack only enough to get a valid match. */
struct re_pattern_buffer *
-compile_pattern (pattern, regp, translate, posix, multibyte)
- Lisp_Object pattern;
- struct re_registers *regp;
- Lisp_Object translate;
- int posix, multibyte;
+compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object translate, int posix, int multibyte)
{
struct regexp_cache *cp, **cpp;
@@ -290,9 +281,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
static Lisp_Object
-looking_at_1 (string, posix)
- Lisp_Object string;
- int posix;
+looking_at_1 (Lisp_Object string, int posix)
{
Lisp_Object val;
unsigned char *p1, *p2;
@@ -392,9 +381,7 @@ data if you want to preserve them. */)
}
static Lisp_Object
-string_match_1 (regexp, string, start, posix)
- Lisp_Object regexp, string, start;
- int posix;
+string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix)
{
int val;
struct re_pattern_buffer *bufp;
@@ -499,8 +486,7 @@ matched by parenthesis constructs in the pattern. */)
This does not clobber the match data. */
int
-fast_string_match (regexp, string)
- Lisp_Object regexp, string;
+fast_string_match (Lisp_Object regexp, Lisp_Object string)
{
int val;
struct re_pattern_buffer *bufp;
@@ -525,9 +511,7 @@ fast_string_match (regexp, string)
extern Lisp_Object Vascii_downcase_table;
int
-fast_c_string_match_ignore_case (regexp, string)
- Lisp_Object regexp;
- const char *string;
+fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string)
{
int val;
struct re_pattern_buffer *bufp;
@@ -547,8 +531,7 @@ fast_c_string_match_ignore_case (regexp, string)
/* Like fast_string_match but ignore case. */
int
-fast_string_match_ignore_case (regexp, string)
- Lisp_Object regexp, string;
+fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
{
int val;
struct re_pattern_buffer *bufp;
@@ -572,10 +555,7 @@ fast_string_match_ignore_case (regexp, string)
data. */
EMACS_INT
-fast_looking_at (regexp, pos, pos_byte, limit, limit_byte, string)
- Lisp_Object regexp;
- EMACS_INT pos, pos_byte, limit, limit_byte;
- Lisp_Object string;
+fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT limit, EMACS_INT limit_byte, Lisp_Object string)
{
int multibyte;
struct re_pattern_buffer *buf;
@@ -640,8 +620,7 @@ fast_looking_at (regexp, pos, pos_byte, limit, limit_byte, string)
This is our cheezy way of associating an action with the change of
state of a buffer-local variable. */
static void
-newline_cache_on_off (buf)
- struct buffer *buf;
+newline_cache_on_off (struct buffer *buf)
{
if (NILP (buf->cache_long_line_scans))
{
@@ -682,12 +661,7 @@ newline_cache_on_off (buf)
except when inside redisplay. */
int
-scan_buffer (target, start, end, count, shortage, allow_quit)
- register int target;
- EMACS_INT start, end;
- int count;
- int *shortage;
- int allow_quit;
+scan_buffer (register int target, EMACS_INT start, EMACS_INT end, int count, int *shortage, int allow_quit)
{
struct region_cache *newline_cache;
int direction;
@@ -879,11 +853,7 @@ scan_buffer (target, start, end, count, shortage, allow_quit)
except in special cases. */
int
-scan_newline (start, start_byte, limit, limit_byte, count, allow_quit)
- EMACS_INT start, start_byte;
- EMACS_INT limit, limit_byte;
- register int count;
- int allow_quit;
+scan_newline (EMACS_INT start, EMACS_INT start_byte, EMACS_INT limit, EMACS_INT limit_byte, register int count, int allow_quit)
{
int direction = ((count > 0) ? 1 : -1);
@@ -977,9 +947,7 @@ scan_newline (start, start_byte, limit, limit_byte, count, allow_quit)
}
int
-find_next_newline_no_quit (from, cnt)
- EMACS_INT from;
- int cnt;
+find_next_newline_no_quit (EMACS_INT from, int cnt)
{
return scan_buffer ('\n', from, 0, cnt, (int *) 0, 0);
}
@@ -989,9 +957,7 @@ find_next_newline_no_quit (from, cnt)
find_next_newline (...)-1, because you might hit TO. */
int
-find_before_next_newline (from, to, cnt)
- EMACS_INT from, to;
- int cnt;
+find_before_next_newline (EMACS_INT from, EMACS_INT to, int cnt)
{
int shortage;
int pos = scan_buffer ('\n', from, to, cnt, &shortage, 1);
@@ -1005,11 +971,7 @@ find_before_next_newline (from, to, cnt)
/* Subroutines of Lisp buffer search functions. */
static Lisp_Object
-search_command (string, bound, noerror, count, direction, RE, posix)
- Lisp_Object string, bound, noerror, count;
- int direction;
- int RE;
- int posix;
+search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count, int direction, int RE, int posix)
{
register int np;
int lim, lim_byte;
@@ -1086,8 +1048,7 @@ search_command (string, bound, noerror, count, direction, RE, posix)
/* Return 1 if REGEXP it matches just one constant string. */
static int
-trivial_regexp_p (regexp)
- Lisp_Object regexp;
+trivial_regexp_p (Lisp_Object regexp)
{
int len = SBYTES (regexp);
unsigned char *s = SDATA (regexp);
@@ -1504,13 +1465,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
boyer_moore cannot work. */
static EMACS_INT
-simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
- int n;
- unsigned char *pat;
- int len, len_byte;
- Lisp_Object trt;
- EMACS_INT pos, pos_byte;
- EMACS_INT lim, lim_byte;
+simple_search (int n, unsigned char *pat, int len, int len_byte, Lisp_Object trt, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT lim, EMACS_INT lim_byte)
{
int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
int forward = n > 0;
@@ -2127,8 +2082,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
Also clear out the match data for registers 1 and up. */
static void
-set_search_regs (beg_byte, nbytes)
- EMACS_INT beg_byte, nbytes;
+set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes)
{
int i;
@@ -2162,9 +2116,7 @@ set_search_regs (beg_byte, nbytes)
need not match a word boundary unless it ends in whitespace. */
static Lisp_Object
-wordify (string, lax)
- Lisp_Object string;
- int lax;
+wordify (Lisp_Object string, int lax)
{
register unsigned char *p, *o;
register int i, i_byte, len, punct_count = 0, word_count = 0;
@@ -2886,9 +2838,7 @@ since only regular expressions have distinguished subexpressions. */)
}
static Lisp_Object
-match_limit (num, beginningp)
- Lisp_Object num;
- int beginningp;
+match_limit (Lisp_Object num, int beginningp)
{
register int n;
@@ -3171,7 +3121,7 @@ static Lisp_Object saved_last_thing_searched;
/* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data
if asynchronous code (filter or sentinel) is running. */
static void
-save_search_regs ()
+save_search_regs (void)
{
if (!search_regs_saved)
{
@@ -3190,7 +3140,7 @@ save_search_regs ()
/* Called upon exit from filters and sentinels. */
void
-restore_search_regs ()
+restore_search_regs (void)
{
if (search_regs_saved)
{
@@ -3209,8 +3159,7 @@ restore_search_regs ()
}
static Lisp_Object
-unwind_set_match_data (list)
- Lisp_Object list;
+unwind_set_match_data (Lisp_Object list)
{
/* It is NOT ALWAYS safe to free (evaporate) the markers immediately. */
return Fset_match_data (list, Qt);
@@ -3218,7 +3167,7 @@ unwind_set_match_data (list)
/* Called to unwind protect the match data. */
void
-record_unwind_save_match_data ()
+record_unwind_save_match_data (void)
{
record_unwind_protect (unwind_set_match_data,
Fmatch_data (Qnil, Qnil, Qnil));
@@ -3262,7 +3211,7 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
}
void
-syms_of_search ()
+syms_of_search (void)
{
register int i;