]> arthur.barton.de Git - bup.git/commitdiff
Avoid len as a variable name
authorGabriel Filion <lelutin@gmail.com>
Fri, 30 Apr 2010 05:53:12 +0000 (01:53 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 30 Apr 2010 06:07:49 +0000 (02:07 -0400)
As discussed earlier on the mailing list, the "len" builtin is used very
often, and using "len" as a variable name can get confusing.

Change all occurrences of "len" as a variable to "sz" to keep it short
and meaningful.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
lib/bup/helpers.py

index fd6df7603930a67a638ced93f08a3f8c06867305..931a1fdfc107187111617c96e39411a6e04a16a0 100644 (file)
@@ -207,21 +207,21 @@ def slashappend(s):
         return s
 
 
-def _mmap_do(f, len, flags, prot):
-    if not len:
+def _mmap_do(f, sz, flags, prot):
+    if not sz:
         st = os.fstat(f.fileno())
-        len = st.st_size
-    map = mmap.mmap(f.fileno(), len, flags, prot)
+        sz = st.st_size
+    map = mmap.mmap(f.fileno(), sz, flags, prot)
     f.close()  # map will persist beyond file close
     return map
 
 
-def mmap_read(f, len = 0):
-    return _mmap_do(f, len, mmap.MAP_PRIVATE, mmap.PROT_READ)
+def mmap_read(f, sz = 0):
+    return _mmap_do(f, sz, mmap.MAP_PRIVATE, mmap.PROT_READ)
 
 
-def mmap_readwrite(f, len = 0):
-    return _mmap_do(f, len, mmap.MAP_SHARED, mmap.PROT_READ|mmap.PROT_WRITE)
+def mmap_readwrite(f, sz = 0):
+    return _mmap_do(f, sz, mmap.MAP_SHARED, mmap.PROT_READ|mmap.PROT_WRITE)
 
 
 def parse_num(s):