From 3d2f10f3af72349fee45fea148a120a6d36ae741 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 12 Jan 2009 15:35:29 +0000 Subject: Slightly more obvious logic. This code still sucks. svn path=/trunk/libcss/; revision=6047 --- src/parse/properties.c | 30 +++++++++++++++--------------- 1 file 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++ = ' '; } -- cgit v1.2.3