[Python-checkins] r75300 - python/trunk/Parser/tokenizer.c

benjamin.peterson python-checkins at python.org
Fri Oct 9 23:48:15 CEST 2009


Author: benjamin.peterson
Date: Fri Oct  9 23:48:14 2009
New Revision: 75300

Log:
fix some coding style

Modified:
   python/trunk/Parser/tokenizer.c

Modified: python/trunk/Parser/tokenizer.c
==============================================================================
--- python/trunk/Parser/tokenizer.c	(original)
+++ python/trunk/Parser/tokenizer.c	Fri Oct  9 23:48:14 2009
@@ -180,20 +180,26 @@
 	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 @@
 	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 @@
 	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
 }


More information about the Python-checkins mailing list