Dont use static memory for the list of chars options

Saves a couple of KB of RAM and is more flexible in terms
of max number of allowed chars, although for large numbers one really
needs a hash for fast lookups.
This commit is contained in:
Kovid Goyal
2021-06-17 13:27:11 +05:30
parent 6ddbda00df
commit 397638998b
5 changed files with 28 additions and 16 deletions

View File

@@ -14,8 +14,10 @@ combining_type mark_for_codepoint(char_type c);
static inline bool
is_excluded_from_url(uint32_t ch) {
for (size_t i = 0; i < OPT(url_excluded_characters_count); i++) {
if (ch == OPT(url_excluded_characters)[i]) return true;
if (OPT(url_excluded_characters)) {
for (const char_type *p = OPT(url_excluded_characters); *p; p++) {
if (ch == *p) return true;
}
}
return false;
}