[Python-checkins] cpython (merge 3.5 -> default): merge 3.5 (#27093)

benjamin.peterson python-checkins at python.org
Tue May 24 01:48:16 EDT 2016


https://hg.python.org/cpython/rev/7a7f54fe0698
changeset:   101485:7a7f54fe0698
parent:      101482:6147a2c99db0
parent:      101483:3732828f2835
user:        Benjamin Peterson <benjamin at python.org>
date:        Mon May 23 22:48:05 2016 -0700
summary:
  merge 3.5 (#27093)

files:
  Modules/cjkcodecs/cjkcodecs.h |  26 +++++++++++++---------
  1 files changed, 15 insertions(+), 11 deletions(-)


diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -328,22 +328,26 @@
     min = 0;
     max = haystacksize;
 
-    for (pos = haystacksize >> 1; min != max; pos = (min + max) >> 1)
+    for (pos = haystacksize >> 1; min != max; pos = (min + max) >> 1) {
         if (value < haystack[pos].uniseq) {
-            if (max == pos) break;
-            else max = pos;
+            if (max != pos) {
+                max = pos;
+                continue;
+            }
         }
         else if (value > haystack[pos].uniseq) {
-            if (min == pos) break;
-            else min = pos;
+            if (min != pos) {
+                min = pos;
+                continue;
+            }
         }
-        else
-            break;
+        break;
+    }
 
-        if (value == haystack[pos].uniseq)
-            return haystack[pos].code;
-        else
-            return DBCINV;
+    if (value == haystack[pos].uniseq) {
+        return haystack[pos].code;
+    }
+    return DBCINV;
 }
 #endif
 

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


More information about the Python-checkins mailing list