]> granicus.if.org Git - python/commitdiff
fix some coding style
authorBenjamin Peterson <benjamin@python.org>
Fri, 9 Oct 2009 21:48:14 +0000 (21:48 +0000)
committerBenjamin Peterson <benjamin@python.org>
Fri, 9 Oct 2009 21:48:14 +0000 (21:48 +0000)
Parser/tokenizer.c

index 0f6705de0b5559f57d13fce6b6a8d9fc10000655..707e76291c47983f4359813a4a7ccf13a09f9985 100644 (file)
@@ -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
 }