~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/compiled/dirstate_helpers.pyx

  • Committer: John Arbash Meinel
  • Date: 2007-05-04 15:43:46 UTC
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070504154346-fgz2nrtwtd8u9w6a
Clean up bisect_dirstate to not use temporary variables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    # GetItem returns a borrowed reference
27
27
    void *PyDict_GetItem(object p, object key)
28
28
    int PyDict_SetItem(object p, object key, object val) except -1
29
 
    void *PyList_GetItem_void "PyList_GET_ITEM" (object lst, int index)
30
 
    object PyTuple_GetItem_object "PyTuple_GET_ITEM" (void* tpl, int index)
 
29
    void *PyList_GetItem_object_void "PyList_GET_ITEM" (object lst, int index)
 
30
    void *PyTuple_GetItem_void_void "PyTuple_GET_ITEM" (void* tpl, int index)
 
31
    object PyUnicode_Split_void_object "PyUnicode_Split" (void* str, )
31
32
    int PyList_CheckExact(object)
32
33
    int PyTuple_CheckExact(object)
33
34
 
72
73
    cdef int _mid
73
74
    cdef object dirname_split
74
75
    cdef object cur_split
75
 
    cdef void *block
76
 
    cdef object cur
 
76
    cdef void *cur
77
77
 
78
78
    if hi is None:
79
79
        _hi = len(dirblocks)
87
87
    while _lo < _hi:
88
88
        _mid = (_lo+_hi)/2
89
89
        # Grab the dirname for the current dirblock
90
 
        # block = dirblocks[_mid]
91
 
        block = PyList_GetItem_void(dirblocks, _mid)
92
 
        if not PyTuple_CheckExact(<object>block):
93
 
            raise TypeError('We expect to have a list of tuples')
94
 
        # cur = block[0]
95
 
        cur = PyTuple_GetItem_object(block, 0)
96
 
        Py_INCREF(cur)
97
 
        cur_split = cur.split('/')
 
90
        # cur = dirblocks[_mid][0]
 
91
        cur = PyTuple_GetItem_void_void(
 
92
                PyList_GetItem_object_void(dirblocks, _mid), 0)
 
93
        cur_split = (<object>cur).split('/')
98
94
        if cur_split < dirname_split: _lo = _mid+1
99
95
        else: _hi = _mid
100
96
    return _lo