# if defined(PERL_IN_UTF8_C)
#define check_locale_boundary_crossing(a,b,c,d) S_check_locale_boundary_crossing(aTHX_ a,b,c,d)
#define is_utf8_char_slow S_is_utf8_char_slow
-#define is_utf8_common(a,b,c) S_is_utf8_common(aTHX_ a,b,c)
+#define is_utf8_common(a,b,c,d) S_is_utf8_common(aTHX_ a,b,c,d)
#define swatch_get(a,b,c) S_swatch_get(aTHX_ a,b,c)
#define to_lower_latin1(a,b,c) S_to_lower_latin1(aTHX_ a,b,c)
# endif
if (*p == '_')
return TRUE;
/* is_utf8_idstart would be more logical. */
- return is_utf8_common(p, &PL_utf8_idstart, "IdStart");
+ return is_utf8_common(p, &PL_utf8_idstart, "IdStart", NULL);
}
bool
PERL_STATIC_INLINE bool
S_is_utf8_common(pTHX_ const U8 *const p, SV **swash,
- const char *const swashname)
+ const char *const swashname, SV* const invlist)
{
/* returns a boolean giving whether or not the UTF8-encoded character that
* starts at <p> is in the swash indicated by <swashname>. <swash>
* contains a pointer to where the swash indicated by <swashname>
* is to be stored; which this routine will do, so that future calls will
- * look at <*swash> and only generate a swash if it is not null
+ * look at <*swash> and only generate a swash if it is not null. <invlist>
+ * is NULL or an inversion list that defines the swash. If not null, it
+ * saves time during initialization of the swash.
*
* Note that it is assumed that the buffer length of <p> is enough to
* contain all the bytes that comprise the character. Thus, <*p> should
}
if (!*swash) {
U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST;
- *swash = _core_swash_init("utf8", swashname, &PL_sv_undef, 1, 0, NULL, &flags);
+ *swash = _core_swash_init("utf8",
+
+ /* Only use the name if there is no inversion
+ * list; otherwise will go out to disk */
+ (invlist) ? "" : swashname,
+
+ &PL_sv_undef, 1, 0, invlist, &flags);
}
return swash_fetch(*swash, p, TRUE) != 0;
assert(classnum < _FIRST_NON_SWASH_CC);
- return is_utf8_common(p, &PL_utf8_swash_ptrs[classnum], swash_property_names[classnum]);
+ return is_utf8_common(p,
+ &PL_utf8_swash_ptrs[classnum],
+ swash_property_names[classnum],
+ PL_XPosix_ptrs[classnum]);
}
bool
if (*p == '_')
return TRUE;
/* is_utf8_idstart would be more logical. */
- return is_utf8_common(p, &PL_utf8_xidstart, "XIdStart");
+ return is_utf8_common(p, &PL_utf8_xidstart, "XIdStart", NULL);
}
bool
PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART;
- return is_utf8_common(p, &PL_utf8_perl_idstart, "_Perl_IDStart");
+ return is_utf8_common(p, &PL_utf8_perl_idstart, "_Perl_IDStart", NULL);
}
bool
PERL_ARGS_ASSERT__IS_UTF8_PERL_IDCONT;
- return is_utf8_common(p, &PL_utf8_perl_idcont, "_Perl_IDCont");
+ return is_utf8_common(p, &PL_utf8_perl_idcont, "_Perl_IDCont", NULL);
}
PERL_ARGS_ASSERT_IS_UTF8_IDCONT;
- return is_utf8_common(p, &PL_utf8_idcont, "IdContinue");
+ return is_utf8_common(p, &PL_utf8_idcont, "IdContinue", NULL);
}
bool
PERL_ARGS_ASSERT_IS_UTF8_XIDCONT;
- return is_utf8_common(p, &PL_utf8_idcont, "XIdContinue");
+ return is_utf8_common(p, &PL_utf8_idcont, "XIdContinue", NULL);
}
bool
PERL_ARGS_ASSERT__IS_UTF8_MARK;
- return is_utf8_common(p, &PL_utf8_mark, "IsM");
+ return is_utf8_common(p, &PL_utf8_mark, "IsM", NULL);
}
/*