mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-07 22:41:27 +00:00
[ot-tag] Optimize subtag_matches
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
This commit is contained in:
parent
a07d818597
commit
27c11405a2
1 changed files with 4 additions and 3 deletions
|
@ -189,18 +189,19 @@ hb_ot_tag_to_script (hb_tag_t tag)
|
|||
|
||||
/* hb_language_t */
|
||||
|
||||
static bool
|
||||
static inline bool
|
||||
subtag_matches (const char *lang_str,
|
||||
const char *limit,
|
||||
const char *subtag)
|
||||
{
|
||||
unsigned subtag_len = strlen (subtag);
|
||||
do {
|
||||
const char *s = strstr (lang_str, subtag);
|
||||
if (!s || s >= limit)
|
||||
return false;
|
||||
if (!ISALNUM (s[strlen (subtag)]))
|
||||
if (!ISALNUM (s[subtag_len]))
|
||||
return true;
|
||||
lang_str = s + strlen (subtag);
|
||||
lang_str = s + subtag_len;
|
||||
} while (true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue