From ca11d77efd682b62d97be8851cda9afcdea69d7f Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 17 Nov 2012 21:49:07 -0500 Subject: [PATCH] Shorten some longer lines. --- mwparserfromhell/parser/tokenizer.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mwparserfromhell/parser/tokenizer.c b/mwparserfromhell/parser/tokenizer.c index 57c6a62..702e1a3 100644 --- a/mwparserfromhell/parser/tokenizer.c +++ b/mwparserfromhell/parser/tokenizer.c @@ -1169,14 +1169,20 @@ Tokenizer_verify_safe(Tokenizer* self, int context, Py_UNICODE data) } else if (context & LC_FAIL_ON_LBRACE) { if (data == *"{") { - self->topstack->context |= (context & LC_TEMPLATE) ? LC_FAIL_ON_EQUALS : LC_FAIL_NEXT; + if (context & LC_TEMPLATE) + self->topstack->context |= LC_FAIL_ON_EQUALS; + else + self->topstack->context |= LC_FAIL_NEXT; return; } self->topstack->context ^= LC_FAIL_ON_LBRACE; } else if (context & LC_FAIL_ON_RBRACE) { if (data == *"}") { - self->topstack->context |= (context & LC_TEMPLATE) ? LC_FAIL_ON_EQUALS : LC_FAIL_NEXT; + if (context & LC_TEMPLATE) + self->topstack->context |= LC_FAIL_ON_EQUALS; + else + self->topstack->context |= LC_FAIL_NEXT; return; } self->topstack->context ^= LC_FAIL_ON_RBRACE; @@ -1208,8 +1214,10 @@ Tokenizer_verify_safe(Tokenizer* self, int context, Py_UNICODE data) static PyObject* Tokenizer_parse(Tokenizer* self, int context) { - static int fail_contexts = LC_TEMPLATE | LC_ARGUMENT | LC_WIKILINK | LC_HEADING | LC_COMMENT; - static int unsafe_contexts = LC_TEMPLATE_NAME | LC_WIKILINK_TITLE | LC_TEMPLATE_PARAM_KEY | LC_ARGUMENT_NAME; + static int fail_contexts = (LC_TEMPLATE | LC_ARGUMENT | LC_WIKILINK | + LC_HEADING | LC_COMMENT); + static int unsafe_contexts = (LC_TEMPLATE_NAME | LC_WIKILINK_TITLE | + LC_TEMPLATE_PARAM_KEY | LC_ARGUMENT_NAME); int this_context, is_marker, i; Py_UNICODE this, next, next_next, last;