Rev 2679: A bit more cleanup, mostly just reviewing the generated C code in http://bzr.arbash-meinel.com/branches/bzr/0.19-dev/pyrex_knit_extract

John Arbash Meinel john at arbash-meinel.com
Fri Aug 3 03:32:38 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.19-dev/pyrex_knit_extract

------------------------------------------------------------
revno: 2679
revision-id: john at arbash-meinel.com-20070803023207-emqm0vc641no4lps
parent: john at arbash-meinel.com-20070803000035-8lrg5av9vw3zw89j
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: pyrex_knit_extract
timestamp: Thu 2007-08-02 21:32:07 -0500
message:
  A bit more cleanup, mostly just reviewing the generated C code
  to make sure it is reasonable.
modified:
  bzrlib/_knit_helpers_c.pyx     knit_c.pyx-20070509143944-u42gy8w387a10m0j-1
-------------- next part --------------
=== modified file 'bzrlib/_knit_helpers_c.pyx'
--- a/bzrlib/_knit_helpers_c.pyx	2007-08-03 00:00:35 +0000
+++ b/bzrlib/_knit_helpers_c.pyx	2007-08-03 02:32:07 +0000
@@ -521,8 +521,6 @@
         # We have more bytes available to process
         self.bytes_available = self.bytes_available + (avail_out -
                                                        self.strm.avail_out)
-        if self.cur_available == NULL:
-            self.cur_available = self.decompress_buffer
         return 0
 
     cdef int _get_next_line(self, int allow_intermediate) except -1:
@@ -556,7 +554,6 @@
         cdef int bytes_processed
         cdef int found_eol
 
-        bytes_processed = 0
         found_eol = 1
         # TODO: jam 2007-07-24 Figure out how to make this code support lines
         #       of "unlimited" length. Such as a versioned ISO where a single
@@ -737,9 +734,16 @@
                     "Not enough lines in knit data."
                     " Expected %d, only got %d"
                     % (self.num_lines, i))
-            # TODO: We might think about resizing the string in place, or
-            # something like that, but for now, we just create a new string by
-            # combining the two.
+            # TODO: jam 20070802 We might think about resizing the string in
+            #       place, or something like that, but for now, we just create
+            #       a new string by combining the two.
+            #       We could use PyString_Concat, which has the possibility of
+            #       reallocating the current object. However, this translates
+            #       into 'PyNumber_Add', which works, even though it is
+            #       obviously a bit bogus to PyNumber a PyString object.
+            #       However, if we got to this point, then we are already
+            #       dealing with a rare case (a single line in a file > 1MB in
+            #       size). So we'll survive if this code takes a bit longer.
             line = line + PyString_FromStringAndSize(self.cur_line,
                                                      self.cur_line_size)
         return line



More information about the bazaar-commits mailing list