From c1a3d0bb1b2fd93dd6b6d6b94e7897da01bd9083 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 27 Jul 2009 12:17:51 +0000 Subject: Don't intern lower-case versions of strings. Use lwc_context_string_caseless_isequal, instead. svn path=/trunk/libcss/; revision=8815 --- src/parse/language.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/parse/language.h') 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 -- cgit v1.2.3