extern void record_unwind_save_match_data (void);
extern ptrdiff_t fast_string_match_internal (Lisp_Object, Lisp_Object,
Lisp_Object);
+extern ptrdiff_t fast_c_string_match_internal (Lisp_Object, const char *,
+ ptrdiff_t, Lisp_Object);
INLINE ptrdiff_t
fast_string_match (Lisp_Object regexp, Lisp_Object string)
return fast_string_match_internal (regexp, string, Vascii_canon_table);
}
-extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *,
- ptrdiff_t);
+INLINE ptrdiff_t
+fast_c_string_match (Lisp_Object regexp,
+ const char *string, ptrdiff_t len)
+{
+ return fast_c_string_match_internal (regexp, string, len, Qnil);
+}
+
+INLINE ptrdiff_t
+fast_c_string_match_ignore_case (Lisp_Object regexp,
+ const char *string, ptrdiff_t len)
+{
+ return fast_c_string_match_internal (regexp, string, len,
+ Vascii_canon_table);
+}
+
extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t, Lisp_Object);
extern ptrdiff_t find_newline1 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
return val;
}
-/* Match REGEXP against STRING, searching all of STRING ignoring case,
- and return the index of the match, or negative on failure.
- This does not clobber the match data.
+/* 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. Table is a canonicalize table for ignoring case,
+ or nil for none.
+
We assume that STRING contains single-byte characters. */
ptrdiff_t
-fast_c_string_match_ignore_case (Lisp_Object regexp,
- const char *string, ptrdiff_t len)
+fast_c_string_match_internal (Lisp_Object regexp,
+ const char *string, ptrdiff_t len,
+ Lisp_Object table)
{
+ /* FIXME: This is expensive and not obviously correct when it makes
+ a difference. I.e., no longer "fast", and may hide bugs.
+ Something should be done about this. */
regexp = string_make_unibyte (regexp);
+ /* Record specpdl index because freeze_pattern pushes an
+ unwind-protect on the specpdl. */
specpdl_ref count = SPECPDL_INDEX ();
struct regexp_cache *cache_entry
- = compile_pattern (regexp, 0, Vascii_canon_table, 0, 0);
+ = compile_pattern (regexp, 0, table, 0, 0);
freeze_pattern (cache_entry);
re_match_object = Qt;
ptrdiff_t val = re_search (&cache_entry->buf, string, len, 0, len, 0);