]> arthur.barton.de Git - bup.git/commitdiff
vint: remove unnecessary condition
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 29 Jan 2020 19:09:27 +0000 (20:09 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 2 Feb 2020 18:14:35 +0000 (12:14 -0600)
"if c:" can never be false, since we checked before.
Remove the extra condition.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/vint.py

index 143e5b6c75647e46bdbb3ed0bcdc3dbef35ef45b..086cb302087d8edae343631c04c68a87440c35f8 100644 (file)
@@ -85,18 +85,17 @@ def read_vint(port):
     result = 0
     offset = 0
     # Handle first byte with sign bit specially.
     result = 0
     offset = 0
     # Handle first byte with sign bit specially.
-    if c:
-        b = ord(c)
-        if b & 0x40:
-            negative = True
-        result |= (b & 0x3f)
-        if b & 0x80:
-            offset += 6
-            c = port.read(1)
-        elif negative:
-            return -result
-        else:
-            return result
+    b = ord(c)
+    if b & 0x40:
+        negative = True
+    result |= (b & 0x3f)
+    if b & 0x80:
+        offset += 6
+        c = port.read(1)
+    elif negative:
+        return -result
+    else:
+        return result
     while True:
         b = ord(c)
         if b & 0x80:
     while True:
         b = ord(c)
         if b & 0x80: