~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_bencode_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2009-06-19 17:53:37 UTC
  • mto: This revision was merged to the branch mainline in revision 4466.
  • Revision ID: john@arbash-meinel.com-20090619175337-uozt3bntdd48lh4z
Update time_graph to use X:1 ratios rather than 0.xxx ratios.
It is just easier to track now that the new code is much faster.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2007,2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
58
58
    void D_UPDATE_TAIL(Decoder, int n)
59
59
    void E_UPDATE_TAIL(Encoder, int n)
60
60
 
61
 
# To maintain compatibility with older versions of pyrex, we have to use the
62
 
# relative import here, rather than 'bzrlib._static_tuple_c'
63
 
from _static_tuple_c cimport StaticTuple, StaticTuple_CheckExact, \
64
 
    import_static_tuple_c
65
 
 
66
 
import_static_tuple_c()
67
 
 
68
61
 
69
62
cdef class Decoder:
70
63
    """Bencode decoder"""
268
261
        self.maxsize = maxsize
269
262
        self.tail = p
270
263
 
271
 
    def __dealloc__(self):
 
264
    def __del__(self):
272
265
        free(self.buffer)
273
266
        self.buffer = NULL
274
267
        self.maxsize = 0
378
371
                self._encode_int(x)
379
372
            elif PyLong_CheckExact(x):
380
373
                self._encode_long(x)
381
 
            elif (PyList_CheckExact(x) or PyTuple_CheckExact(x)
382
 
                  or StaticTuple_CheckExact(x)):
 
374
            elif PyList_CheckExact(x) or PyTuple_CheckExact(x):
383
375
                self._encode_list(x)
384
376
            elif PyDict_CheckExact(x):
385
377
                self._encode_dict(x)