Rev 3663: flatten the next level in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree
John Arbash Meinel
john at arbash-meinel.com
Thu Aug 21 22:36:05 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree
------------------------------------------------------------
revno: 3663
revision-id: john at arbash-meinel.com-20080821213603-wkxu0as290eh2q1a
parent: john at arbash-meinel.com-20080821213350-z3mh2p34aiiz7nno
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: btree
timestamp: Thu 2008-08-21 16:36:03 -0500
message:
flatten the next level
modified:
bzrlib/_parse_btree_c.pyx _parse_btree_c.pyx-20080703034413-3q25bklkenti3p8p-2
-------------- next part --------------
=== modified file 'bzrlib/_parse_btree_c.pyx'
--- a/bzrlib/_parse_btree_c.pyx 2008-08-21 21:33:50 +0000
+++ b/bzrlib/_parse_btree_c.pyx 2008-08-21 21:36:03 +0000
@@ -263,7 +263,7 @@
cdef Py_ssize_t ref_len
cdef Py_ssize_t next_len
cdef int first_ref_list
- cdef int first_ref
+ cdef int first_reference
cdef int first_key
# I don't expect that we can do faster than string.join()
@@ -324,15 +324,18 @@
out[0] = c'\t'
out = out + 1
first_ref_list = 0
- ref_keys = []
+ first_reference = 1
for reference in ref_list:
- ref_keys.append('\x00'.join(reference))
- flat_ref_list = '\r'.join(ref_keys)
- next_len = PyString_Size(flat_ref_list)
- memcpy(out, PyString_AsString(flat_ref_list), next_len)
- out = out + next_len
+ if first_reference == 0:
+ out[0] = c'\r'
+ out = out + 1
+ first_reference = 0
+ flat_reference = '\x00'.join(reference)
+ next_len = PyString_Size(flat_reference)
+ memcpy(out, PyString_AsString(flat_reference), next_len)
+ out = out + next_len
out[0] = c'\0'
- out = out + 1
+ out = out + 1
memcpy(out, value, value_len)
out = out + value_len
out[0] = c'\n'
More information about the bazaar-commits
mailing list