summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-01-12 15:35:29 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-01-12 15:35:29 +0000
commit3d2f10f3af72349fee45fea148a120a6d36ae741 (patch)
treeb87e880a1519f606efd3bbcd1cd78622b036fcdd
parent0b38b3503242bef1073f7fc304c573fb9b0685a2 (diff)
downloadlibcss-3d2f10f3af72349fee45fea148a120a6d36ae741.tar.gz
libcss-3d2f10f3af72349fee45fea148a120a6d36ae741.tar.bz2
Slightly more obvious logic. This code still sucks.
svn path=/trunk/libcss/; revision=6047
-rw-r--r--src/parse/properties.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/parse/properties.c b/src/parse/properties.c
index 34873cc..21d07a0 100644
--- a/src/parse/properties.c
+++ b/src/parse/properties.c
@@ -2619,17 +2619,17 @@ css_error parse_font_family(css_language *c,
token = parserutils_vector_peek(
vector,
temp_ctx);
- if (token != NULL &&
- token->type !=
+ if (token == NULL ||
+ (token->type !=
CSS_TOKEN_IDENT &&
token->type !=
- CSS_TOKEN_S) {
+ CSS_TOKEN_S)) {
break;
}
/* idents must not match
* generic families */
- if (token != NULL && token->type == CSS_TOKEN_IDENT &&
+ if (token->type == CSS_TOKEN_IDENT &&
(token->ilower == c->strings[SERIF] ||
token->ilower == c->strings[SANS_SERIF] ||
token->ilower == c->strings[CURSIVE] ||
@@ -2742,17 +2742,18 @@ css_error parse_font_family(css_language *c,
while (temp_token != NULL) {
temp_token = parserutils_vector_peek(
vector, temp_ctx);
- if (temp_token != NULL &&
- temp_token->type !=
+ if (temp_token == NULL ||
+ (temp_token->type !=
CSS_TOKEN_IDENT &&
temp_token->type !=
- CSS_TOKEN_S) {
+ CSS_TOKEN_S)) {
break;
}
- if (temp_token != NULL && temp_token->type == CSS_TOKEN_IDENT) {
+ if (temp_token->type ==
+ CSS_TOKEN_IDENT) {
len += temp_token->idata->len;
- } else if (temp_token != NULL) {
+ } else {
len += 1;
}
@@ -2769,22 +2770,21 @@ css_error parse_font_family(css_language *c,
while (token != NULL) {
token = parserutils_vector_peek(
vector, *ctx);
- if (token != NULL &&
- token->type !=
+ if (token == NULL ||
+ (token->type !=
CSS_TOKEN_IDENT &&
token->type !=
- CSS_TOKEN_S) {
+ CSS_TOKEN_S)) {
break;
}
- if (token != NULL &&
- token->type ==
+ if (token->type ==
CSS_TOKEN_IDENT) {
memcpy(p,
token->idata->data,
token->idata->len);
p += token->idata->len;
- } else if (token != NULL) {
+ } else {
*p++ = ' ';
}