summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1992-07-22 03:10:28 +0000
committerRichard M. Stallman <rms@gnu.org>1992-07-22 03:10:28 +0000
commitb68c34a12f2bfb9e92b3db1fda69dd2b5e5773b0 (patch)
tree49dbe6b0f9aa560cbd8e18af1d0e3d7b01bfce1d /src/search.c
parent3c2fb420672f29cec42cbeb658c91837b044d4d8 (diff)
downloademacs-b68c34a12f2bfb9e92b3db1fda69dd2b5e5773b0.tar.gz
entered into RCS
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index f0ee12f4119..83ddaeba143 100644
--- a/src/search.c
+++ b/src/search.c
@@ -227,6 +227,25 @@ matched by parenthesis constructs in the pattern.")
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.