# HG changeset patch # User Richard M. Stallman # Date 711774628 0 # Node ID 5ce0a9ac1ea70bde363fb97347206818bd846dfd # Parent 2cdce064065fef4a2ab73fb6e1161cea8ec86735 entered into RCS diff -r 2cdce064065f -r 5ce0a9ac1ea7 src/search.c --- a/src/search.c Wed Jul 22 02:58:48 1992 +0000 +++ b/src/search.c Wed Jul 22 03:10:28 1992 +0000 @@ -227,6 +227,25 @@ if (val < 0) return Qnil; return make_number (val); } + +/* Match REGEXP against STRING, searching all of STRING, + and return the index of the match, or negative on failure. + This does not clobber the match data. */ + +int +fast_string_match (regexp, string) + Lisp_Object regexp, string; +{ + int val; + + compile_pattern (regexp, &searchbuf, 0, 0); + immediate_quit = 1; + val = re_search (&searchbuf, (char *) XSTRING (string)->data, + XSTRING (string)->size, 0, XSTRING (string)->size, + 0); + immediate_quit = 0; + return val; +} /* Search for COUNT instances of the character TARGET, starting at START. If COUNT is negative, search backwards.