diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-07-27 12:17:51 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-07-27 12:17:51 +0000 |
commit | c1a3d0bb1b2fd93dd6b6d6b94e7897da01bd9083 (patch) | |
tree | f9e177429a1112f1672c74f07ebfc3e0e9cb60b8 /src/parse/language.h | |
parent | e20927d57c447c7b74af4f00f1ecbd19b554ab65 (diff) | |
download | libcss-c1a3d0bb1b2fd93dd6b6d6b94e7897da01bd9083.tar.gz libcss-c1a3d0bb1b2fd93dd6b6d6b94e7897da01bd9083.tar.bz2 |
Don't intern lower-case versions of strings. Use lwc_context_string_caseless_isequal, instead.
svn path=/trunk/libcss/; revision=8815
Diffstat (limited to 'src/parse/language.h')
-rw-r--r-- | src/parse/language.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/parse/language.h b/src/parse/language.h index 0b1d56f..5668c55 100644 --- a/src/parse/language.h +++ b/src/parse/language.h @@ -73,9 +73,20 @@ static inline void consumeWhitespace(const parserutils_vector *vector, int *ctx) */ static inline bool tokenIsChar(const css_token *token, uint8_t c) { - return token != NULL && token->type == CSS_TOKEN_CHAR && - lwc_string_length(token->ilower) == 1 && - lwc_string_data(token->ilower)[0] == c; + bool result = false; + + if (token != NULL && token->type == CSS_TOKEN_CHAR && + lwc_string_length(token->idata) == 1) { + char d = lwc_string_data(token->idata)[0]; + + /* Ensure lowercase comparison */ + if ('A' <= d && d <= 'Z') + d += 'a' - 'A'; + + result = (d == c); + } + + return result; } #endif |