[Python-checkins] cpython: fix spacing around switch statements

benjamin.peterson python-checkins at python.org
Wed Dec 21 18:22:34 CET 2011


http://hg.python.org/cpython/rev/6cc55bb70714
changeset:   74118:6cc55bb70714
parent:      74102:ac29dc61873c
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Dec 20 17:23:42 2011 -0600
summary:
  fix spacing around switch statements

files:
  Objects/unicodeobject.c |  45 ++++++++++++++--------------
  1 files changed, 22 insertions(+), 23 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -871,7 +871,7 @@
     {
         if (!PyUnicode_IS_READY(unicode))
             return "wstr";
-        switch(PyUnicode_KIND(unicode))
+        switch (PyUnicode_KIND(unicode))
         {
         case PyUnicode_1BYTE_KIND:
             if (PyUnicode_IS_ASCII(unicode))
@@ -887,8 +887,7 @@
         }
     }
     assert(PyUnicode_IS_READY(unicode));
-    switch(PyUnicode_KIND(unicode))
-    {
+    switch (PyUnicode_KIND(unicode)) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(unicode))
             return "ascii";
@@ -1791,7 +1790,7 @@
 static Py_UCS4
 kind_maxchar_limit(unsigned int kind)
 {
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         return 0x80;
     case PyUnicode_2BYTE_KIND:
@@ -1892,7 +1891,7 @@
         PyErr_SetString(PyExc_ValueError, "size must be positive");
         return NULL;
     }
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         return _PyUnicode_FromUCS1(buffer, size);
     case PyUnicode_2BYTE_KIND:
@@ -1994,7 +1993,7 @@
         PyErr_SetString(PyExc_SystemError, "invalid widening attempt");
         return NULL;
     }
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_2BYTE_KIND:
         result = PyMem_Malloc(len * sizeof(Py_UCS2));
         if (!result)
@@ -5007,7 +5006,7 @@
     data = PyUnicode_DATA(unicode);
     size = PyUnicode_GET_LENGTH(unicode);
 
-    switch(kind) {
+    switch (kind) {
     default:
         assert(0);
     case PyUnicode_1BYTE_KIND:
@@ -6026,7 +6025,7 @@
     len = PyUnicode_GET_LENGTH(unicode);
     kind = PyUnicode_KIND(unicode);
     data = PyUnicode_DATA(unicode);
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND: expandsize = 4; break;
     case PyUnicode_2BYTE_KIND: expandsize = 6; break;
     case PyUnicode_4BYTE_KIND: expandsize = 10; break;
@@ -9028,7 +9027,7 @@
     len2 = PyUnicode_GET_LENGTH(s2);
 
     if (direction > 0) {
-        switch(kind) {
+        switch (kind) {
         case PyUnicode_1BYTE_KIND:
             if (PyUnicode_IS_ASCII(s1) && PyUnicode_IS_ASCII(s2))
                 result = asciilib_find_slice(buf1, len1, buf2, len2, start, end);
@@ -9046,7 +9045,7 @@
         }
     }
     else {
-        switch(kind) {
+        switch (kind) {
         case PyUnicode_1BYTE_KIND:
             if (PyUnicode_IS_ASCII(s1) && PyUnicode_IS_ASCII(s2))
                 result = asciilib_rfind_slice(buf1, len1, buf2, len2, start, end);
@@ -9080,7 +9079,7 @@
                                    const char *grouping,
                                    const char *thousands_sep)
 {
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         if (unicode != NULL && PyUnicode_IS_ASCII(unicode))
             return _PyUnicode_ascii_InsertThousandsGrouping(
@@ -9158,7 +9157,7 @@
     len2 = PyUnicode_GET_LENGTH(sub_obj);
 
     ADJUST_INDICES(start, end, len1);
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(str_obj) && PyUnicode_IS_ASCII(sub_obj))
             result = asciilib_count(
@@ -9860,7 +9859,7 @@
     if (string == NULL || PyUnicode_READY(string) == -1)
         return NULL;
 
-    switch(PyUnicode_KIND(string)) {
+    switch (PyUnicode_KIND(string)) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(string))
             list = asciilib_splitlines(
@@ -9906,7 +9905,7 @@
         return NULL;
 
     if (substring == NULL)
-        switch(PyUnicode_KIND(self)) {
+        switch (PyUnicode_KIND(self)) {
         case PyUnicode_1BYTE_KIND:
             if (PyUnicode_IS_ASCII(self))
                 return asciilib_split_whitespace(
@@ -9954,7 +9953,7 @@
     len1 = PyUnicode_GET_LENGTH(self);
     len2 = PyUnicode_GET_LENGTH(substring);
 
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(self) && PyUnicode_IS_ASCII(substring))
             out = asciilib_split(
@@ -9998,7 +9997,7 @@
         return NULL;
 
     if (substring == NULL)
-        switch(PyUnicode_KIND(self)) {
+        switch (PyUnicode_KIND(self)) {
         case PyUnicode_1BYTE_KIND:
             if (PyUnicode_IS_ASCII(self))
                 return asciilib_rsplit_whitespace(
@@ -10046,7 +10045,7 @@
     len1 = PyUnicode_GET_LENGTH(self);
     len2 = PyUnicode_GET_LENGTH(substring);
 
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(self) && PyUnicode_IS_ASCII(substring))
             out = asciilib_rsplit(
@@ -10077,7 +10076,7 @@
 anylib_find(int kind, PyObject *str1, void *buf1, Py_ssize_t len1,
             PyObject *str2, void *buf2, Py_ssize_t len2, Py_ssize_t offset)
 {
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(str1) && PyUnicode_IS_ASCII(str2))
             return asciilib_find(buf1, len1, buf2, len2, offset);
@@ -10096,7 +10095,7 @@
 anylib_count(int kind, PyObject *sstr, void* sbuf, Py_ssize_t slen,
              PyObject *str1, void *buf1, Py_ssize_t len1, Py_ssize_t maxcount)
 {
-        switch(kind) {
+        switch (kind) {
         case PyUnicode_1BYTE_KIND:
             if (PyUnicode_IS_ASCII(sstr) && PyUnicode_IS_ASCII(str1))
                 return asciilib_count(sbuf, slen, buf1, len1, maxcount);
@@ -10680,7 +10679,7 @@
     len1 = PyUnicode_GET_LENGTH(str);
     len2 = PyUnicode_GET_LENGTH(sub);
 
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         result = ucs1lib_find(buf1, len1, buf2, len2, 0) != -1;
         break;
@@ -10900,7 +10899,7 @@
     len2 = PyUnicode_GET_LENGTH(substring);
 
     ADJUST_INDICES(start, end, len1);
-    switch(kind) {
+    switch (kind) {
     case PyUnicode_1BYTE_KIND:
         iresult = ucs1lib_count(
             ((Py_UCS1*)buf1) + start, end - start,
@@ -12323,7 +12322,7 @@
     len1 = PyUnicode_GET_LENGTH(str_obj);
     len2 = PyUnicode_GET_LENGTH(sep_obj);
 
-    switch(PyUnicode_KIND(str_obj)) {
+    switch (PyUnicode_KIND(str_obj)) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(str_obj) && PyUnicode_IS_ASCII(sep_obj))
             out = asciilib_partition(str_obj, buf1, len1, sep_obj, buf2, len2);
@@ -12395,7 +12394,7 @@
     len1 = PyUnicode_GET_LENGTH(str_obj);
     len2 = PyUnicode_GET_LENGTH(sep_obj);
 
-    switch(PyUnicode_KIND(str_in)) {
+    switch (PyUnicode_KIND(str_in)) {
     case PyUnicode_1BYTE_KIND:
         if (PyUnicode_IS_ASCII(str_obj) && PyUnicode_IS_ASCII(sep_obj))
             out = asciilib_rpartition(str_obj, buf1, len1, sep_obj, buf2, len2);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list