diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-10-09 21:48:14 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-10-09 21:48:14 (GMT) |
commit | 9586cf8677225ba3bae946de4813655c3db90f88 (patch) | |
tree | 587feba41320c117e45b244bee904d87e11145b6 | |
parent | 49b881410b7901bc2cb25c39205431cc6fb37745 (diff) | |
download | cpython-9586cf8677225ba3bae946de4813655c3db90f88.zip cpython-9586cf8677225ba3bae946de4813655c3db90f88.tar.gz cpython-9586cf8677225ba3bae946de4813655c3db90f88.tar.bz2 |
fix some coding style
-rw-r--r-- | Parser/tokenizer.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 0f6705d..707e762 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -180,20 +180,26 @@ get_normal_name(char *s) /* for utf-8 and latin-1 */ int i; for (i = 0; i < 12; i++) { int c = s[i]; - if (c == '\0') break; - else if (c == '_') buf[i] = '-'; - else buf[i] = tolower(c); + if (c == '\0') + break; + else if (c == '_') + buf[i] = '-'; + else + buf[i] = tolower(c); } buf[i] = '\0'; if (strcmp(buf, "utf-8") == 0 || - strncmp(buf, "utf-8-", 6) == 0) return "utf-8"; + strncmp(buf, "utf-8-", 6) == 0) + return "utf-8"; else if (strcmp(buf, "latin-1") == 0 || strcmp(buf, "iso-8859-1") == 0 || strcmp(buf, "iso-latin-1") == 0 || strncmp(buf, "latin-1-", 8) == 0 || strncmp(buf, "iso-8859-1-", 11) == 0 || - strncmp(buf, "iso-latin-1-", 12) == 0) return "iso-8859-1"; - else return s; + strncmp(buf, "iso-latin-1-", 12) == 0) + return "iso-8859-1"; + else + return s; } /* Return the coding spec in S, or NULL if none is found. */ @@ -309,18 +315,28 @@ check_bom(int get_char(struct tok_state *), if (ch == EOF) { return 1; } else if (ch == 0xEF) { - ch = get_char(tok); if (ch != 0xBB) goto NON_BOM; - ch = get_char(tok); if (ch != 0xBF) goto NON_BOM; + ch = get_char(tok); + if (ch != 0xBB) + goto NON_BOM; + ch = get_char(tok); + if (ch != 0xBF) + goto NON_BOM; #if 0 /* Disable support for UTF-16 BOMs until a decision is made whether this needs to be supported. */ } else if (ch == 0xFE) { - ch = get_char(tok); if (ch != 0xFF) goto NON_BOM; - if (!set_readline(tok, "utf-16-be")) return 0; + ch = get_char(tok); + if (ch != 0xFF) + goto NON_BOM; + if (!set_readline(tok, "utf-16-be")) + return 0; tok->decoding_state = -1; } else if (ch == 0xFF) { - ch = get_char(tok); if (ch != 0xFE) goto NON_BOM; - if (!set_readline(tok, "utf-16-le")) return 0; + ch = get_char(tok); + if (ch != 0xFE) + goto NON_BOM; + if (!set_readline(tok, "utf-16-le")) + return 0; tok->decoding_state = -1; #endif } else { @@ -397,7 +413,8 @@ fp_readl(char *s, int size, struct tok_state *tok) memcpy(s, str, utf8len); s[utf8len] = '\0'; Py_DECREF(utf8); - if (utf8len == 0) return NULL; /* EOF */ + if (utf8len == 0) + return NULL; /* EOF */ return s; #endif } |