~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_btree_serializer_pyx.pyx

  • Committer: INADA Naoki
  • Date: 2011-05-17 00:45:09 UTC
  • mfrom: (5875 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5891.
  • Revision ID: songofacandy@gmail.com-20110517004509-q58negjbdjh7t6u1
mergeĀ fromĀ lp:bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
496
496
    return val
497
497
 
498
498
 
499
 
cdef _format_record_py24(gc_chk_sha1_record *record):
500
 
    """Python2.4 PyString_FromFormat doesn't have %u.
501
 
 
502
 
    It only has %d and %ld. We would really like to even have %llu, which
503
 
    is only in python2.7. So we go back into casting to regular objects.
504
 
    """
505
 
    return "%s %s %s %s" % (record.block_offset, record.block_length,
506
 
                            record.record_start, record.record_end)
507
 
 
508
 
 
509
499
cdef _format_record(gc_chk_sha1_record *record):
510
500
    # This is inefficient to go from a logical state back to a
511
501
    # string, but it makes things work a bit better internally for now.
524
514
                                    record.record_start, record.record_end)
525
515
    return value
526
516
 
527
 
ctypedef object (*formatproc)(gc_chk_sha1_record *)
528
 
cdef formatproc _record_formatter
529
 
_record_formatter = _format_record
530
 
if sys.version_info[:2] == (2, 4):
531
 
    _record_formatter = _format_record_py24
532
 
 
533
517
 
534
518
cdef class GCCHKSHA1LeafNode:
535
519
    """Track all the entries for a given leaf node."""
593
577
        cdef StaticTuple value_and_refs
594
578
        cdef StaticTuple empty
595
579
        value_and_refs = StaticTuple_New(2)
596
 
        value = _record_formatter(record)
 
580
        value = _format_record(record)
597
581
        Py_INCREF(value)
598
582
        StaticTuple_SET_ITEM(value_and_refs, 0, value)
599
583
        # Always empty refs