/* Generated by Cython 0.13 on Thu May 26 17:26:28 2011 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact # define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE_API__bzrlib___btree_serializer_pyx #include "python-compat.h" #include "stdlib.h" #include "string.h" #include "_static_tuple_c.h" /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || defined(__INTEL_COMPILER) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "_btree_serializer_pyx.pyx", "_static_tuple_c.pxd", }; /* Type declarations */ /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":337 * # One slightly ugly option would be to cache block offsets in a global. * # However, that leads to thread-safety issues, etc. * ctypedef struct gc_chk_sha1_record: # <<<<<<<<<<<<<< * long long block_offset * unsigned int block_length */ typedef struct { PY_LONG_LONG block_offset; unsigned int block_length; unsigned int record_start; unsigned int record_end; char sha1[20]; } __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":123 * * * cdef class BTreeLeafParser: # <<<<<<<<<<<<<< * """Parse the leaf nodes of a BTree index. * */ struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser { PyObject_HEAD struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_vtab; PyObject *bytes; int key_length; int ref_list_length; PyObject *keys; char *_cur_str; char *_end_str; char *_start; int _header_found; }; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":518 * * * cdef class GCCHKSHA1LeafNode: # <<<<<<<<<<<<<< * """Track all the entries for a given leaf node.""" * */ struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode { PyObject_HEAD struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_vtab; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *records; PyObject *last_key; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *last_record; int num_records; unsigned char common_shift; unsigned char offsets[257]; }; struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode { StaticTuple *(*_record_to_value_and_refs)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *); StaticTuple *(*_record_to_item)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *); __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *(*_lookup_record)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *); int (*_count_records)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *, char *); PyObject *(*_parse_bytes)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, PyObject *); char *(*_parse_one_entry)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *, char *, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *); int (*_offset_for_sha1)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *); PyObject *(*_compute_common)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *); }; static struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":123 * * * cdef class BTreeLeafParser: # <<<<<<<<<<<<<< * """Parse the leaf nodes of a BTree index. * */ struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser { PyObject *(*extract_key)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *, char *); int (*process_line)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *); }; static struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) #else #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); Py_INCREF(r); return r; } } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { r = PySequence_GetItem(o, i); } else { r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } return r; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static void __Pyx_WriteUnraisable(const char *name); /*proto*/ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from bzrlib._static_tuple_c */ /* Module declarations from bzrlib._static_tuple_c */ static PyTypeObject *__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = 0; /* Module declarations from bzrlib._btree_serializer_pyx */ static PyTypeObject *__pyx_ptype_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = 0; static PyTypeObject *__pyx_ptype_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode = 0; static int __pyx_v_6bzrlib_21_btree_serializer_pyx__unhexbuf[256]; static char *__pyx_v_6bzrlib_21_btree_serializer_pyx__hexbuf; static void *__pyx_f_6bzrlib_21_btree_serializer_pyx__my_memrchr(void *, int, size_t); /*proto*/ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(char *, Py_ssize_t); /*proto*/ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size(char *, Py_ssize_t); /*proto*/ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__populate_unhexbuf(void); /*proto*/ static int __pyx_f_6bzrlib_21_btree_serializer_pyx__unhexlify_sha1(char *, char *); /*proto*/ static void __pyx_f_6bzrlib_21_btree_serializer_pyx__hexlify_sha1(char *, char *); /*proto*/ static int __pyx_f_6bzrlib_21_btree_serializer_pyx__key_to_sha1(PyObject *, char *); /*proto*/ static StaticTuple *__pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_key(char *); /*proto*/ static unsigned int __pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_uint(char *); /*proto*/ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__format_record(__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *); /*proto*/ #define __Pyx_MODULE_NAME "bzrlib._btree_serializer_pyx" int __pyx_module_is_main_bzrlib___btree_serializer_pyx = 0; /* Implementation of bzrlib._btree_serializer_pyx */ static PyObject *__pyx_builtin_AssertionError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_TypeError; static char __pyx_k_1[] = "tried to create a string with an invalid size: %d @0x%x"; static char __pyx_k_2[] = "invalid key, wanted segment from "; static char __pyx_k_3[] = "sha1:"; static char __pyx_k_4[] = "last < self._start"; static char __pyx_k_5[] = "type=leaf"; static char __pyx_k_6[] = "Node did not start with \"type=leaf\": %r"; static char __pyx_k_7[] = "Failed to find the value area"; static char __pyx_k_8[] = " 0 0"; static char __pyx_k_9[] = "invalid key, loop_counter != self.ref_list_length"; static char __pyx_k_10[] = "unexpected reference data present"; static char __pyx_k_11[] = "self.bytes is not a string."; static char __pyx_k_12[] = "not a 40-byte hex digest"; static char __pyx_k_13[] = "not a 20-byte binary digest"; static char __pyx_k_14[] = "sha1_bin must be a str of exactly 20 bytes"; static char __pyx_k_15[] = "%s %u %u %u"; static char __pyx_k_16[] = "%lu %u %u %u"; static char __pyx_k_17[] = "_record_to_value_and_refs"; static char __pyx_k_18[] = "key %r is not present"; static char __pyx_k_19[] = "We only support parsing plain 8-bit strings."; static char __pyx_k_20[] = "type=leaf\n"; static char __pyx_k_21[] = "bytes did not start with 'type=leaf\\n': %r"; static char __pyx_k_22[] = "Something went wrong while parsing."; static char __pyx_k_23[] = "line did not start with sha1: %r"; static char __pyx_k_24[] = "Line did not contain 40 hex bytes"; static char __pyx_k_25[] = "We failed to unhexlify"; static char __pyx_k_26[] = "only 1 null, not 2 as expected"; static char __pyx_k_27[] = "Failed to parse block offset"; static char __pyx_k_28[] = "Failed to parse block length"; static char __pyx_k_29[] = "Failed to parse record end"; static char __pyx_k_30[] = "We expected a tuple() or StaticTuple() for node not: %s"; static char __pyx_k_31[] = "With ref_lists, we expected 4 entries not: %s"; static char __pyx_k_32[] = "Without ref_lists, we need at least 3 entries not: %s"; static char __pyx_k_33[] = "\000"; static char __pyx_k_34[] = "We expect references to be tuples not: %s"; static char __pyx_k_35[] = "We expect reference bits to be strings not: %s"; static char __pyx_k_36[] = "Expected a plain str for value not: %s"; static char __pyx_k_37[] = "Pyrex extensions to btree node parsing."; static char __pyx_k_38[] = "_py_unhexlify (line 386)"; static char __pyx_k_39[] = "_py_hexlify (line 409)"; static char __pyx_k_40[] = "_py_key_to_sha1 (line 446)"; static char __pyx_k_41[] = "_py_sha1_to_key (line 482)"; static char __pyx_k_42[] = "_parse_into_chk (line 838)"; static char __pyx_k_43[] = "_flatten_node (line 845)"; static char __pyx_k__sys[] = "sys"; static char __pyx_k__join[] = "join"; static char __pyx_k__keys[] = "keys"; static char __pyx_k__node[] = "node"; static char __pyx_k__sha1[] = "sha1"; static char __pyx_k__bytes[] = "bytes"; static char __pyx_k__parse[] = "parse"; static char __pyx_k___start[] = "_start"; static char __pyx_k__offsets[] = "offsets"; static char __pyx_k__records[] = "records"; static char __pyx_k__KeyError[] = "KeyError"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k___cur_str[] = "_cur_str"; static char __pyx_k___end_str[] = "_end_str"; static char __pyx_k__last_key[] = "last_key"; static char __pyx_k__TypeError[] = "TypeError"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__key_length[] = "key_length"; static char __pyx_k__record_end[] = "record_end"; static char __pyx_k___py_hexlify[] = "_py_hexlify"; static char __pyx_k__extract_key[] = "extract_key"; static char __pyx_k__last_record[] = "last_record"; static char __pyx_k__num_records[] = "num_records"; static char __pyx_k___parse_bytes[] = "_parse_bytes"; static char __pyx_k__block_length[] = "block_length"; static char __pyx_k__block_offset[] = "block_offset"; static char __pyx_k__common_shift[] = "common_shift"; static char __pyx_k__process_line[] = "process_line"; static char __pyx_k__record_start[] = "record_start"; static char __pyx_k___flatten_node[] = "_flatten_node"; static char __pyx_k___header_found[] = "_header_found"; static char __pyx_k___py_unhexlify[] = "_py_unhexlify"; static char __pyx_k__AssertionError[] = "AssertionError"; static char __pyx_k___count_records[] = "_count_records"; static char __pyx_k___lookup_record[] = "_lookup_record"; static char __pyx_k___compute_common[] = "_compute_common"; static char __pyx_k___parse_into_chk[] = "_parse_into_chk"; static char __pyx_k___py_key_to_sha1[] = "_py_key_to_sha1"; static char __pyx_k___py_sha1_to_key[] = "_py_sha1_to_key"; static char __pyx_k___record_to_item[] = "_record_to_item"; static char __pyx_k__ref_list_length[] = "ref_list_length"; static char __pyx_k__reference_lists[] = "reference_lists"; static char __pyx_k__0123456789abcdef[] = "0123456789abcdef"; static char __pyx_k___offset_for_sha1[] = "_offset_for_sha1"; static char __pyx_k___parse_one_entry[] = "_parse_one_entry"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_s_10; static PyObject *__pyx_kp_s_11; static PyObject *__pyx_kp_s_12; static PyObject *__pyx_kp_s_13; static PyObject *__pyx_kp_s_14; static PyObject *__pyx_n_s_17; static PyObject *__pyx_kp_s_18; static PyObject *__pyx_kp_s_19; static PyObject *__pyx_kp_s_2; static PyObject *__pyx_kp_s_21; static PyObject *__pyx_kp_s_22; static PyObject *__pyx_kp_s_23; static PyObject *__pyx_kp_s_24; static PyObject *__pyx_kp_s_25; static PyObject *__pyx_kp_s_26; static PyObject *__pyx_kp_s_27; static PyObject *__pyx_kp_s_28; static PyObject *__pyx_kp_s_29; static PyObject *__pyx_kp_s_30; static PyObject *__pyx_kp_s_31; static PyObject *__pyx_kp_s_32; static PyObject *__pyx_kp_s_33; static PyObject *__pyx_kp_s_34; static PyObject *__pyx_kp_s_35; static PyObject *__pyx_kp_s_36; static PyObject *__pyx_kp_u_38; static PyObject *__pyx_kp_u_39; static PyObject *__pyx_kp_s_4; static PyObject *__pyx_kp_u_40; static PyObject *__pyx_kp_u_41; static PyObject *__pyx_kp_u_42; static PyObject *__pyx_kp_u_43; static PyObject *__pyx_kp_s_6; static PyObject *__pyx_kp_s_7; static PyObject *__pyx_kp_s_9; static PyObject *__pyx_n_s__AssertionError; static PyObject *__pyx_n_s__KeyError; static PyObject *__pyx_n_s__TypeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___compute_common; static PyObject *__pyx_n_s___count_records; static PyObject *__pyx_n_s___cur_str; static PyObject *__pyx_n_s___end_str; static PyObject *__pyx_n_s___flatten_node; static PyObject *__pyx_n_s___header_found; static PyObject *__pyx_n_s___lookup_record; static PyObject *__pyx_n_s___offset_for_sha1; static PyObject *__pyx_n_s___parse_bytes; static PyObject *__pyx_n_s___parse_into_chk; static PyObject *__pyx_n_s___parse_one_entry; static PyObject *__pyx_n_s___py_hexlify; static PyObject *__pyx_n_s___py_key_to_sha1; static PyObject *__pyx_n_s___py_sha1_to_key; static PyObject *__pyx_n_s___py_unhexlify; static PyObject *__pyx_n_s___record_to_item; static PyObject *__pyx_n_s___start; static PyObject *__pyx_n_s__block_length; static PyObject *__pyx_n_s__block_offset; static PyObject *__pyx_n_s__bytes; static PyObject *__pyx_n_s__common_shift; static PyObject *__pyx_n_s__extract_key; static PyObject *__pyx_n_s__join; static PyObject *__pyx_n_s__key_length; static PyObject *__pyx_n_s__keys; static PyObject *__pyx_n_s__last_key; static PyObject *__pyx_n_s__last_record; static PyObject *__pyx_n_s__node; static PyObject *__pyx_n_s__num_records; static PyObject *__pyx_n_s__offsets; static PyObject *__pyx_n_s__parse; static PyObject *__pyx_n_s__process_line; static PyObject *__pyx_n_s__record_end; static PyObject *__pyx_n_s__record_start; static PyObject *__pyx_n_s__records; static PyObject *__pyx_n_s__ref_list_length; static PyObject *__pyx_n_s__reference_lists; static PyObject *__pyx_n_s__sha1; static PyObject *__pyx_n_s__sys; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":81 * * # TODO: Find some way to import this from _dirstate_helpers * cdef void* _my_memrchr(void *s, int c, size_t n): # cannot_raise # <<<<<<<<<<<<<< * # memrchr seems to be a GNU extension, so we have to implement it ourselves * # It is not present in any win32 standard library */ static void *__pyx_f_6bzrlib_21_btree_serializer_pyx__my_memrchr(void *__pyx_v_s, int __pyx_v_c, size_t __pyx_v_n) { char *__pyx_v_pos; char *__pyx_v_start; void *__pyx_r; int __pyx_t_1; __Pyx_RefNannySetupContext("_my_memrchr"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":87 * cdef char *start * * start = s # <<<<<<<<<<<<<< * pos = start + n - 1 * while pos >= start: */ __pyx_v_start = ((char *)__pyx_v_s); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":88 * * start = s * pos = start + n - 1 # <<<<<<<<<<<<<< * while pos >= start: * if pos[0] == c: */ __pyx_v_pos = ((__pyx_v_start + __pyx_v_n) - 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":89 * start = s * pos = start + n - 1 * while pos >= start: # <<<<<<<<<<<<<< * if pos[0] == c: * return pos */ while (1) { __pyx_t_1 = (__pyx_v_pos >= __pyx_v_start); if (!__pyx_t_1) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":90 * pos = start + n - 1 * while pos >= start: * if pos[0] == c: # <<<<<<<<<<<<<< * return pos * pos = pos - 1 */ __pyx_t_1 = ((__pyx_v_pos[0]) == __pyx_v_c); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":91 * while pos >= start: * if pos[0] == c: * return pos # <<<<<<<<<<<<<< * pos = pos - 1 * return NULL */ __pyx_r = ((void *)__pyx_v_pos); goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":92 * if pos[0] == c: * return pos * pos = pos - 1 # <<<<<<<<<<<<<< * return NULL * */ __pyx_v_pos = (__pyx_v_pos - 1); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":93 * return pos * pos = pos - 1 * return NULL # <<<<<<<<<<<<<< * * */ __pyx_r = NULL; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":97 * * # TODO: Import this from _dirstate_helpers when it is merged * cdef object safe_string_from_size(char *s, Py_ssize_t size): # <<<<<<<<<<<<<< * if size < 0: * raise AssertionError( */ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(char *__pyx_v_s, Py_ssize_t __pyx_v_size) { PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("safe_string_from_size"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":98 * # TODO: Import this from _dirstate_helpers when it is merged * cdef object safe_string_from_size(char *s, Py_ssize_t size): * if size < 0: # <<<<<<<<<<<<<< * raise AssertionError( * 'tried to create a string with an invalid size: %d @0x%x' */ __pyx_t_1 = (__pyx_v_size < 0); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":101 * raise AssertionError( * 'tried to create a string with an invalid size: %d @0x%x' * % (size, s)) # <<<<<<<<<<<<<< * return PyString_FromStringAndSize(s, size) * */ __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(((int)__pyx_v_s)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":102 * 'tried to create a string with an invalid size: %d @0x%x' * % (size, s)) * return PyString_FromStringAndSize(s, size) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_s, __pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.safe_string_from_size"); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":105 * * * cdef object safe_interned_string_from_size(char *s, Py_ssize_t size): # <<<<<<<<<<<<<< * cdef PyObject *py_str * if size < 0: */ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size(char *__pyx_v_s, Py_ssize_t __pyx_v_size) { PyObject *__pyx_v_py_str; PyObject *__pyx_v_result; PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("safe_interned_string_from_size"); __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":107 * cdef object safe_interned_string_from_size(char *s, Py_ssize_t size): * cdef PyObject *py_str * if size < 0: # <<<<<<<<<<<<<< * raise AssertionError( * 'tried to create a string with an invalid size: %d @0x%x' */ __pyx_t_1 = (__pyx_v_size < 0); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":110 * raise AssertionError( * 'tried to create a string with an invalid size: %d @0x%x' * % (size, s)) # <<<<<<<<<<<<<< * py_str = PyString_FromStringAndSize_ptr(s, size) * PyString_InternInPlace(&py_str) */ __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyInt_FromLong(((int)__pyx_v_s)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":111 * 'tried to create a string with an invalid size: %d @0x%x' * % (size, s)) * py_str = PyString_FromStringAndSize_ptr(s, size) # <<<<<<<<<<<<<< * PyString_InternInPlace(&py_str) * result = py_str */ __pyx_v_py_str = PyString_FromStringAndSize(__pyx_v_s, __pyx_v_size); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":112 * % (size, s)) * py_str = PyString_FromStringAndSize_ptr(s, size) * PyString_InternInPlace(&py_str) # <<<<<<<<<<<<<< * result = py_str * # Casting a PyObject* to an triggers an INCREF from Pyrex, so we */ PyString_InternInPlace((&__pyx_v_py_str)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":113 * py_str = PyString_FromStringAndSize_ptr(s, size) * PyString_InternInPlace(&py_str) * result = py_str # <<<<<<<<<<<<<< * # Casting a PyObject* to an triggers an INCREF from Pyrex, so we * # DECREF it to avoid geting immortal strings */ __Pyx_INCREF(((PyObject *)__pyx_v_py_str)); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = ((PyObject *)__pyx_v_py_str); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":116 * # Casting a PyObject* to an triggers an INCREF from Pyrex, so we * # DECREF it to avoid geting immortal strings * Py_DECREF_ptr(py_str) # <<<<<<<<<<<<<< * return result * */ Py_DECREF(__pyx_v_py_str); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":117 * # DECREF it to avoid geting immortal strings * Py_DECREF_ptr(py_str) * return result # <<<<<<<<<<<<<< * * # This sets up the StaticTuple C_API functionality */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.safe_interned_string_from_size"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":153 * cdef int _header_found * * def __init__(self, bytes, key_length, ref_list_length): # <<<<<<<<<<<<<< * self.bytes = bytes * self.key_length = key_length */ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_bytes = 0; PyObject *__pyx_v_key_length = 0; PyObject *__pyx_v_ref_list_length = 0; int __pyx_r; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bytes,&__pyx_n_s__key_length,&__pyx_n_s__ref_list_length,0}; __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bytes); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key_length); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref_list_length); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_bytes = values[0]; __pyx_v_key_length = values[1]; __pyx_v_ref_list_length = values[2]; } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __pyx_v_bytes = PyTuple_GET_ITEM(__pyx_args, 0); __pyx_v_key_length = PyTuple_GET_ITEM(__pyx_args, 1); __pyx_v_ref_list_length = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.__init__"); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":154 * * def __init__(self, bytes, key_length, ref_list_length): * self.bytes = bytes # <<<<<<<<<<<<<< * self.key_length = key_length * self.ref_list_length = ref_list_length */ __Pyx_INCREF(__pyx_v_bytes); __Pyx_GIVEREF(__pyx_v_bytes); __Pyx_GOTREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes); __Pyx_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes); ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes = __pyx_v_bytes; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":155 * def __init__(self, bytes, key_length, ref_list_length): * self.bytes = bytes * self.key_length = key_length # <<<<<<<<<<<<<< * self.ref_list_length = ref_list_length * self.keys = [] */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_key_length); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->key_length = __pyx_t_1; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":156 * self.bytes = bytes * self.key_length = key_length * self.ref_list_length = ref_list_length # <<<<<<<<<<<<<< * self.keys = [] * self._cur_str = NULL */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_ref_list_length); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->ref_list_length = __pyx_t_1; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":157 * self.key_length = key_length * self.ref_list_length = ref_list_length * self.keys = [] # <<<<<<<<<<<<<< * self._cur_str = NULL * self._end_str = NULL */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __Pyx_GOTREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys); __Pyx_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys); ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":158 * self.ref_list_length = ref_list_length * self.keys = [] * self._cur_str = NULL # <<<<<<<<<<<<<< * self._end_str = NULL * self._header_found = 0 */ ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str = NULL; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":159 * self.keys = [] * self._cur_str = NULL * self._end_str = NULL # <<<<<<<<<<<<<< * self._header_found = 0 * # keys are tuples */ ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_end_str = NULL; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":160 * self._cur_str = NULL * self._end_str = NULL * self._header_found = 0 # <<<<<<<<<<<<<< * # keys are tuples * */ ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_header_found = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.__init__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":163 * # keys are tuples * * cdef extract_key(self, char * last): # <<<<<<<<<<<<<< * """Extract a key. * */ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_extract_key(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_v_self, char *__pyx_v_last) { char *__pyx_v_temp_ptr; int __pyx_v_loop_counter; StaticTuple *__pyx_v_key; PyObject *__pyx_v_failure_string; PyObject *__pyx_v_key_element; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; __Pyx_RefNannySetupContext("extract_key"); __pyx_v_key = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_failure_string = Py_None; __Pyx_INCREF(Py_None); __pyx_v_key_element = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":173 * cdef StaticTuple key * * key = StaticTuple_New(self.key_length) # <<<<<<<<<<<<<< * for loop_counter from 0 <= loop_counter < self.key_length: * # grab a key segment */ __pyx_t_1 = ((PyObject *)StaticTuple_New(__pyx_v_self->key_length)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_key)); __pyx_v_key = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":174 * * key = StaticTuple_New(self.key_length) * for loop_counter from 0 <= loop_counter < self.key_length: # <<<<<<<<<<<<<< * # grab a key segment * temp_ptr = memchr(self._start, c'\0', last - self._start) */ __pyx_t_2 = __pyx_v_self->key_length; for (__pyx_v_loop_counter = 0; __pyx_v_loop_counter < __pyx_t_2; __pyx_v_loop_counter++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":176 * for loop_counter from 0 <= loop_counter < self.key_length: * # grab a key segment * temp_ptr = memchr(self._start, c'\0', last - self._start) # <<<<<<<<<<<<<< * if temp_ptr == NULL: * if loop_counter + 1 == self.key_length: */ __pyx_v_temp_ptr = ((char *)memchr(__pyx_v_self->_start, '\x00', (__pyx_v_last - __pyx_v_self->_start))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":177 * # grab a key segment * temp_ptr = memchr(self._start, c'\0', last - self._start) * if temp_ptr == NULL: # <<<<<<<<<<<<<< * if loop_counter + 1 == self.key_length: * # capture to last */ __pyx_t_3 = (__pyx_v_temp_ptr == NULL); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":178 * temp_ptr = memchr(self._start, c'\0', last - self._start) * if temp_ptr == NULL: * if loop_counter + 1 == self.key_length: # <<<<<<<<<<<<<< * # capture to last * temp_ptr = last */ __pyx_t_3 = ((__pyx_v_loop_counter + 1) == __pyx_v_self->key_length); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":180 * if loop_counter + 1 == self.key_length: * # capture to last * temp_ptr = last # <<<<<<<<<<<<<< * else: * # Invalid line */ __pyx_v_temp_ptr = __pyx_v_last; goto __pyx_L6; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":185 * failure_string = ("invalid key, wanted segment from " + * repr(safe_string_from_size(self._start, * last - self._start))) # <<<<<<<<<<<<<< * raise AssertionError(failure_string) * # capture the key string */ __pyx_t_1 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(__pyx_v_self->_start, (__pyx_v_last - __pyx_v_self->_start)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_2), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_failure_string); __pyx_v_failure_string = __pyx_t_1; __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":186 * repr(safe_string_from_size(self._start, * last - self._start))) * raise AssertionError(failure_string) # <<<<<<<<<<<<<< * # capture the key string * if (self.key_length == 1 */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_failure_string); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_failure_string); __Pyx_GIVEREF(__pyx_v_failure_string); __pyx_t_4 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L6:; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":188 * raise AssertionError(failure_string) * # capture the key string * if (self.key_length == 1 # <<<<<<<<<<<<<< * and (temp_ptr - self._start) == 45 * and strncmp(self._start, 'sha1:', 5) == 0): */ __pyx_t_3 = (__pyx_v_self->key_length == 1); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":189 * # capture the key string * if (self.key_length == 1 * and (temp_ptr - self._start) == 45 # <<<<<<<<<<<<<< * and strncmp(self._start, 'sha1:', 5) == 0): * key_element = safe_string_from_size(self._start, */ __pyx_t_5 = ((__pyx_v_temp_ptr - __pyx_v_self->_start) == 45); if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":190 * if (self.key_length == 1 * and (temp_ptr - self._start) == 45 * and strncmp(self._start, 'sha1:', 5) == 0): # <<<<<<<<<<<<<< * key_element = safe_string_from_size(self._start, * temp_ptr - self._start) */ __pyx_t_6 = (strncmp(__pyx_v_self->_start, __pyx_k_3, 5) == 0); __pyx_t_7 = __pyx_t_6; } else { __pyx_t_7 = __pyx_t_5; } __pyx_t_5 = __pyx_t_7; } else { __pyx_t_5 = __pyx_t_3; } if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":192 * and strncmp(self._start, 'sha1:', 5) == 0): * key_element = safe_string_from_size(self._start, * temp_ptr - self._start) # <<<<<<<<<<<<<< * else: * key_element = safe_interned_string_from_size(self._start, */ __pyx_t_4 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(__pyx_v_self->_start, (__pyx_v_temp_ptr - __pyx_v_self->_start)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_v_key_element); __pyx_v_key_element = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L7; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":195 * else: * key_element = safe_interned_string_from_size(self._start, * temp_ptr - self._start) # <<<<<<<<<<<<<< * # advance our pointer * self._start = temp_ptr + 1 */ __pyx_t_4 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size(__pyx_v_self->_start, (__pyx_v_temp_ptr - __pyx_v_self->_start)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_v_key_element); __pyx_v_key_element = __pyx_t_4; __pyx_t_4 = 0; } __pyx_L7:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":197 * temp_ptr - self._start) * # advance our pointer * self._start = temp_ptr + 1 # <<<<<<<<<<<<<< * Py_INCREF(key_element) * StaticTuple_SET_ITEM(key, loop_counter, key_element) */ __pyx_v_self->_start = (__pyx_v_temp_ptr + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":198 * # advance our pointer * self._start = temp_ptr + 1 * Py_INCREF(key_element) # <<<<<<<<<<<<<< * StaticTuple_SET_ITEM(key, loop_counter, key_element) * key = StaticTuple_Intern(key) */ Py_INCREF(__pyx_v_key_element); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":199 * self._start = temp_ptr + 1 * Py_INCREF(key_element) * StaticTuple_SET_ITEM(key, loop_counter, key_element) # <<<<<<<<<<<<<< * key = StaticTuple_Intern(key) * return key */ StaticTuple_SET_ITEM(__pyx_v_key, __pyx_v_loop_counter, __pyx_v_key_element); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":200 * Py_INCREF(key_element) * StaticTuple_SET_ITEM(key, loop_counter, key_element) * key = StaticTuple_Intern(key) # <<<<<<<<<<<<<< * return key * */ __pyx_t_4 = ((PyObject *)StaticTuple_Intern(__pyx_v_key)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_v_key)); __pyx_v_key = ((StaticTuple *)__pyx_t_4); __pyx_t_4 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":201 * StaticTuple_SET_ITEM(key, loop_counter, key_element) * key = StaticTuple_Intern(key) * return key # <<<<<<<<<<<<<< * * cdef int process_line(self) except -1: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_key)); __pyx_r = ((PyObject *)__pyx_v_key); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.extract_key"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_key); __Pyx_DECREF(__pyx_v_failure_string); __Pyx_DECREF(__pyx_v_key_element); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":203 * return key * * cdef int process_line(self) except -1: # <<<<<<<<<<<<<< * """Process a line in the bytes.""" * cdef char *last */ static int __pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_process_line(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_v_self) { char *__pyx_v_last; char *__pyx_v_temp_ptr; char *__pyx_v_ref_ptr; char *__pyx_v_next_start; int __pyx_v_loop_counter; Py_ssize_t __pyx_v_str_len; PyObject *__pyx_v_key; PyObject *__pyx_v_value; StaticTuple *__pyx_v_ref_lists; PyObject *__pyx_v_ref_list; StaticTuple *__pyx_v_node_value; int __pyx_r; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; __Pyx_RefNannySetupContext("process_line"); __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); __pyx_v_ref_lists = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_ref_list = Py_None; __Pyx_INCREF(Py_None); __pyx_v_node_value = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":212 * cdef Py_ssize_t str_len * * self._start = self._cur_str # <<<<<<<<<<<<<< * # Find the next newline * last = memchr(self._start, c'\n', self._end_str - self._start) */ __pyx_v_self->_start = __pyx_v_self->_cur_str; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":214 * self._start = self._cur_str * # Find the next newline * last = memchr(self._start, c'\n', self._end_str - self._start) # <<<<<<<<<<<<<< * if last == NULL: * # Process until the end of the file */ __pyx_v_last = ((char *)memchr(__pyx_v_self->_start, '\n', (__pyx_v_self->_end_str - __pyx_v_self->_start))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":215 * # Find the next newline * last = memchr(self._start, c'\n', self._end_str - self._start) * if last == NULL: # <<<<<<<<<<<<<< * # Process until the end of the file * last = self._end_str */ __pyx_t_1 = (__pyx_v_last == NULL); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":217 * if last == NULL: * # Process until the end of the file * last = self._end_str # <<<<<<<<<<<<<< * self._cur_str = self._end_str * else: */ __pyx_v_last = __pyx_v_self->_end_str; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":218 * # Process until the end of the file * last = self._end_str * self._cur_str = self._end_str # <<<<<<<<<<<<<< * else: * # And the next string is right after it */ __pyx_v_self->_cur_str = __pyx_v_self->_end_str; goto __pyx_L3; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":221 * else: * # And the next string is right after it * self._cur_str = last + 1 # <<<<<<<<<<<<<< * # The last character is right before the '\n' * */ __pyx_v_self->_cur_str = (__pyx_v_last + 1); } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":224 * # The last character is right before the '\n' * * if last == self._start: # <<<<<<<<<<<<<< * # parsed it all. * return 0 */ __pyx_t_1 = (__pyx_v_last == __pyx_v_self->_start); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":226 * if last == self._start: * # parsed it all. * return 0 # <<<<<<<<<<<<<< * if last < self._start: * # Unexpected error condition - fail */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":227 * # parsed it all. * return 0 * if last < self._start: # <<<<<<<<<<<<<< * # Unexpected error condition - fail * raise AssertionError("last < self._start") */ __pyx_t_1 = (__pyx_v_last < __pyx_v_self->_start); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":229 * if last < self._start: * # Unexpected error condition - fail * raise AssertionError("last < self._start") # <<<<<<<<<<<<<< * if 0 == self._header_found: * # The first line in a leaf node is the header "type=leaf\n" */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __pyx_t_3 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":230 * # Unexpected error condition - fail * raise AssertionError("last < self._start") * if 0 == self._header_found: # <<<<<<<<<<<<<< * # The first line in a leaf node is the header "type=leaf\n" * if strncmp("type=leaf", self._start, last - self._start) == 0: */ __pyx_t_1 = (0 == __pyx_v_self->_header_found); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":232 * if 0 == self._header_found: * # The first line in a leaf node is the header "type=leaf\n" * if strncmp("type=leaf", self._start, last - self._start) == 0: # <<<<<<<<<<<<<< * self._header_found = 1 * return 0 */ __pyx_t_1 = (strncmp(__pyx_k_5, __pyx_v_self->_start, (__pyx_v_last - __pyx_v_self->_start)) == 0); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":233 * # The first line in a leaf node is the header "type=leaf\n" * if strncmp("type=leaf", self._start, last - self._start) == 0: * self._header_found = 1 # <<<<<<<<<<<<<< * return 0 * else: */ __pyx_v_self->_header_found = 1; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":234 * if strncmp("type=leaf", self._start, last - self._start) == 0: * self._header_found = 1 * return 0 # <<<<<<<<<<<<<< * else: * raise AssertionError('Node did not start with "type=leaf": %r' */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L7; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":237 * else: * raise AssertionError('Node did not start with "type=leaf": %r' * % (safe_string_from_size(self._start, last - self._start))) # <<<<<<<<<<<<<< * * key = self.extract_key(last) */ __pyx_t_3 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(__pyx_v_self->_start, (__pyx_v_last - __pyx_v_self->_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; goto __pyx_L6; } __pyx_L6:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":239 * % (safe_string_from_size(self._start, last - self._start))) * * key = self.extract_key(last) # <<<<<<<<<<<<<< * # find the value area * temp_ptr = _my_memrchr(self._start, c'\0', last - self._start) */ __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self->__pyx_vtab)->extract_key(__pyx_v_self, __pyx_v_last); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_key); __pyx_v_key = __pyx_t_2; __pyx_t_2 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":241 * key = self.extract_key(last) * # find the value area * temp_ptr = _my_memrchr(self._start, c'\0', last - self._start) # <<<<<<<<<<<<<< * if temp_ptr == NULL: * # Invalid line */ __pyx_v_temp_ptr = ((char *)__pyx_f_6bzrlib_21_btree_serializer_pyx__my_memrchr(__pyx_v_self->_start, '\x00', (__pyx_v_last - __pyx_v_self->_start))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":242 * # find the value area * temp_ptr = _my_memrchr(self._start, c'\0', last - self._start) * if temp_ptr == NULL: # <<<<<<<<<<<<<< * # Invalid line * raise AssertionError("Failed to find the value area") */ __pyx_t_1 = (__pyx_v_temp_ptr == NULL); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":244 * if temp_ptr == NULL: * # Invalid line * raise AssertionError("Failed to find the value area") # <<<<<<<<<<<<<< * else: * # Because of how conversions were done, we ended up with *lots* of */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); __pyx_t_3 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":252 * # something like '12607215 328306 0 0', which ends up consuming 1MB * # of memory, just for those strings. * str_len = last - temp_ptr - 1 # <<<<<<<<<<<<<< * if (str_len > 4 * and strncmp(" 0 0", last - 4, 4) == 0): */ __pyx_v_str_len = ((__pyx_v_last - __pyx_v_temp_ptr) - 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":253 * # of memory, just for those strings. * str_len = last - temp_ptr - 1 * if (str_len > 4 # <<<<<<<<<<<<<< * and strncmp(" 0 0", last - 4, 4) == 0): * # This drops peak mem for bzr.dev from 87.4MB => 86.2MB */ __pyx_t_1 = (__pyx_v_str_len > 4); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":254 * str_len = last - temp_ptr - 1 * if (str_len > 4 * and strncmp(" 0 0", last - 4, 4) == 0): # <<<<<<<<<<<<<< * # This drops peak mem for bzr.dev from 87.4MB => 86.2MB * # For Launchpad 236MB => 232MB */ __pyx_t_4 = (strncmp(__pyx_k_8, (__pyx_v_last - 4), 4) == 0); __pyx_t_5 = __pyx_t_4; } else { __pyx_t_5 = __pyx_t_1; } if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":257 * # This drops peak mem for bzr.dev from 87.4MB => 86.2MB * # For Launchpad 236MB => 232MB * value = safe_interned_string_from_size(temp_ptr + 1, str_len) # <<<<<<<<<<<<<< * else: * value = safe_string_from_size(temp_ptr + 1, str_len) */ __pyx_t_3 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_interned_string_from_size((__pyx_v_temp_ptr + 1), __pyx_v_str_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_value); __pyx_v_value = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L9; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":259 * value = safe_interned_string_from_size(temp_ptr + 1, str_len) * else: * value = safe_string_from_size(temp_ptr + 1, str_len) # <<<<<<<<<<<<<< * # shrink the references end point * last = temp_ptr */ __pyx_t_3 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size((__pyx_v_temp_ptr + 1), __pyx_v_str_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_value); __pyx_v_value = __pyx_t_3; __pyx_t_3 = 0; } __pyx_L9:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":261 * value = safe_string_from_size(temp_ptr + 1, str_len) * # shrink the references end point * last = temp_ptr # <<<<<<<<<<<<<< * * if self.ref_list_length: */ __pyx_v_last = __pyx_v_temp_ptr; } __pyx_L8:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":263 * last = temp_ptr * * if self.ref_list_length: # <<<<<<<<<<<<<< * ref_lists = StaticTuple_New(self.ref_list_length) * loop_counter = 0 */ if (__pyx_v_self->ref_list_length) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":264 * * if self.ref_list_length: * ref_lists = StaticTuple_New(self.ref_list_length) # <<<<<<<<<<<<<< * loop_counter = 0 * while loop_counter < self.ref_list_length: */ __pyx_t_3 = ((PyObject *)StaticTuple_New(__pyx_v_self->ref_list_length)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_v_ref_lists)); __pyx_v_ref_lists = ((StaticTuple *)__pyx_t_3); __pyx_t_3 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":265 * if self.ref_list_length: * ref_lists = StaticTuple_New(self.ref_list_length) * loop_counter = 0 # <<<<<<<<<<<<<< * while loop_counter < self.ref_list_length: * ref_list = [] */ __pyx_v_loop_counter = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":266 * ref_lists = StaticTuple_New(self.ref_list_length) * loop_counter = 0 * while loop_counter < self.ref_list_length: # <<<<<<<<<<<<<< * ref_list = [] * # extract a reference list */ while (1) { __pyx_t_5 = (__pyx_v_loop_counter < __pyx_v_self->ref_list_length); if (!__pyx_t_5) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":267 * loop_counter = 0 * while loop_counter < self.ref_list_length: * ref_list = [] # <<<<<<<<<<<<<< * # extract a reference list * loop_counter = loop_counter + 1 */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_v_ref_list); __pyx_v_ref_list = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":269 * ref_list = [] * # extract a reference list * loop_counter = loop_counter + 1 # <<<<<<<<<<<<<< * if last < self._start: * raise AssertionError("last < self._start") */ __pyx_v_loop_counter = (__pyx_v_loop_counter + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":270 * # extract a reference list * loop_counter = loop_counter + 1 * if last < self._start: # <<<<<<<<<<<<<< * raise AssertionError("last < self._start") * # find the next reference list end point: */ __pyx_t_5 = (__pyx_v_last < __pyx_v_self->_start); if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":271 * loop_counter = loop_counter + 1 * if last < self._start: * raise AssertionError("last < self._start") # <<<<<<<<<<<<<< * # find the next reference list end point: * temp_ptr = memchr(self._start, c'\t', last - self._start) */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __pyx_t_2 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L13; } __pyx_L13:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":273 * raise AssertionError("last < self._start") * # find the next reference list end point: * temp_ptr = memchr(self._start, c'\t', last - self._start) # <<<<<<<<<<<<<< * if temp_ptr == NULL: * # Only valid for the last list */ __pyx_v_temp_ptr = ((char *)memchr(__pyx_v_self->_start, '\t', (__pyx_v_last - __pyx_v_self->_start))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":274 * # find the next reference list end point: * temp_ptr = memchr(self._start, c'\t', last - self._start) * if temp_ptr == NULL: # <<<<<<<<<<<<<< * # Only valid for the last list * if loop_counter != self.ref_list_length: */ __pyx_t_5 = (__pyx_v_temp_ptr == NULL); if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":276 * if temp_ptr == NULL: * # Only valid for the last list * if loop_counter != self.ref_list_length: # <<<<<<<<<<<<<< * # Invalid line * raise AssertionError( */ __pyx_t_5 = (__pyx_v_loop_counter != __pyx_v_self->ref_list_length); if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":278 * if loop_counter != self.ref_list_length: * # Invalid line * raise AssertionError( # <<<<<<<<<<<<<< * "invalid key, loop_counter != self.ref_list_length") * else: */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); __pyx_t_3 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L15; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":282 * else: * # scan to the end of the ref list area * ref_ptr = last # <<<<<<<<<<<<<< * next_start = last * else: */ __pyx_v_ref_ptr = __pyx_v_last; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":283 * # scan to the end of the ref list area * ref_ptr = last * next_start = last # <<<<<<<<<<<<<< * else: * # scan to the end of this ref list */ __pyx_v_next_start = __pyx_v_last; } __pyx_L15:; goto __pyx_L14; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":286 * else: * # scan to the end of this ref list * ref_ptr = temp_ptr # <<<<<<<<<<<<<< * next_start = temp_ptr + 1 * # Now, there may be multiple keys in the ref list. */ __pyx_v_ref_ptr = __pyx_v_temp_ptr; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":287 * # scan to the end of this ref list * ref_ptr = temp_ptr * next_start = temp_ptr + 1 # <<<<<<<<<<<<<< * # Now, there may be multiple keys in the ref list. * while self._start < ref_ptr: */ __pyx_v_next_start = (__pyx_v_temp_ptr + 1); } __pyx_L14:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":289 * next_start = temp_ptr + 1 * # Now, there may be multiple keys in the ref list. * while self._start < ref_ptr: # <<<<<<<<<<<<<< * # loop finding keys and extracting them * temp_ptr = memchr(self._start, c'\r', */ while (1) { __pyx_t_5 = (__pyx_v_self->_start < __pyx_v_ref_ptr); if (!__pyx_t_5) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":292 * # loop finding keys and extracting them * temp_ptr = memchr(self._start, c'\r', * ref_ptr - self._start) # <<<<<<<<<<<<<< * if temp_ptr == NULL: * # key runs to the end */ __pyx_v_temp_ptr = ((char *)memchr(__pyx_v_self->_start, '\r', (__pyx_v_ref_ptr - __pyx_v_self->_start))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":293 * temp_ptr = memchr(self._start, c'\r', * ref_ptr - self._start) * if temp_ptr == NULL: # <<<<<<<<<<<<<< * # key runs to the end * temp_ptr = ref_ptr */ __pyx_t_5 = (__pyx_v_temp_ptr == NULL); if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":295 * if temp_ptr == NULL: * # key runs to the end * temp_ptr = ref_ptr # <<<<<<<<<<<<<< * * PyList_Append(ref_list, self.extract_key(temp_ptr)) */ __pyx_v_temp_ptr = __pyx_v_ref_ptr; goto __pyx_L18; } __pyx_L18:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":297 * temp_ptr = ref_ptr * * PyList_Append(ref_list, self.extract_key(temp_ptr)) # <<<<<<<<<<<<<< * ref_list = StaticTuple_Intern(StaticTuple(*ref_list)) * Py_INCREF(ref_list) */ __pyx_t_3 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self->__pyx_vtab)->extract_key(__pyx_v_self, __pyx_v_temp_ptr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyList_Append(__pyx_v_ref_list, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":298 * * PyList_Append(ref_list, self.extract_key(temp_ptr)) * ref_list = StaticTuple_Intern(StaticTuple(*ref_list)) # <<<<<<<<<<<<<< * Py_INCREF(ref_list) * StaticTuple_SET_ITEM(ref_lists, loop_counter - 1, ref_list) */ __pyx_t_3 = PySequence_Tuple(__pyx_v_ref_list); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = ((PyObject *)StaticTuple_Intern(((StaticTuple *)__pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_ref_list); __pyx_v_ref_list = __pyx_t_3; __pyx_t_3 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":299 * PyList_Append(ref_list, self.extract_key(temp_ptr)) * ref_list = StaticTuple_Intern(StaticTuple(*ref_list)) * Py_INCREF(ref_list) # <<<<<<<<<<<<<< * StaticTuple_SET_ITEM(ref_lists, loop_counter - 1, ref_list) * # prepare for the next reference list */ Py_INCREF(__pyx_v_ref_list); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":300 * ref_list = StaticTuple_Intern(StaticTuple(*ref_list)) * Py_INCREF(ref_list) * StaticTuple_SET_ITEM(ref_lists, loop_counter - 1, ref_list) # <<<<<<<<<<<<<< * # prepare for the next reference list * self._start = next_start */ StaticTuple_SET_ITEM(__pyx_v_ref_lists, (__pyx_v_loop_counter - 1), __pyx_v_ref_list); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":302 * StaticTuple_SET_ITEM(ref_lists, loop_counter - 1, ref_list) * # prepare for the next reference list * self._start = next_start # <<<<<<<<<<<<<< * node_value = StaticTuple(value, ref_lists) * else: */ __pyx_v_self->_start = __pyx_v_next_start; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":303 * # prepare for the next reference list * self._start = next_start * node_value = StaticTuple(value, ref_lists) # <<<<<<<<<<<<<< * else: * if last != self._start: */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_INCREF(((PyObject *)__pyx_v_ref_lists)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_ref_lists)); __Pyx_GIVEREF(((PyObject *)__pyx_v_ref_lists)); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_node_value)); __pyx_v_node_value = ((StaticTuple *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L10; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":305 * node_value = StaticTuple(value, ref_lists) * else: * if last != self._start: # <<<<<<<<<<<<<< * # unexpected reference data present * raise AssertionError("unexpected reference data present") */ __pyx_t_5 = (__pyx_v_last != __pyx_v_self->_start); if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":307 * if last != self._start: * # unexpected reference data present * raise AssertionError("unexpected reference data present") # <<<<<<<<<<<<<< * node_value = StaticTuple(value, StaticTuple()) * PyList_Append(self.keys, StaticTuple(key, node_value)) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_10)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10)); __pyx_t_3 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L19; } __pyx_L19:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":308 * # unexpected reference data present * raise AssertionError("unexpected reference data present") * node_value = StaticTuple(value, StaticTuple()) # <<<<<<<<<<<<<< * PyList_Append(self.keys, StaticTuple(key, node_value)) * return 0 */ __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_node_value)); __pyx_v_node_value = ((StaticTuple *)__pyx_t_3); __pyx_t_3 = 0; } __pyx_L10:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":309 * raise AssertionError("unexpected reference data present") * node_value = StaticTuple(value, StaticTuple()) * PyList_Append(self.keys, StaticTuple(key, node_value)) # <<<<<<<<<<<<<< * return 0 * */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_key); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); __Pyx_INCREF(((PyObject *)__pyx_v_node_value)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_node_value)); __Pyx_GIVEREF(((PyObject *)__pyx_v_node_value)); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = PyList_Append(__pyx_v_self->keys, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":310 * node_value = StaticTuple(value, StaticTuple()) * PyList_Append(self.keys, StaticTuple(key, node_value)) * return 0 # <<<<<<<<<<<<<< * * def parse(self): */ __pyx_r = 0; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.process_line"); __pyx_r = -1; __pyx_L0:; __Pyx_DECREF(__pyx_v_key); __Pyx_DECREF(__pyx_v_value); __Pyx_DECREF((PyObject *)__pyx_v_ref_lists); __Pyx_DECREF(__pyx_v_ref_list); __Pyx_DECREF((PyObject *)__pyx_v_node_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":312 * return 0 * * def parse(self): # <<<<<<<<<<<<<< * cdef Py_ssize_t byte_count * if not PyString_CheckExact(self.bytes): */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_parse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_parse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { Py_ssize_t __pyx_v_byte_count; PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; char *__pyx_t_4; int __pyx_t_5; __Pyx_RefNannySetupContext("parse"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":314 * def parse(self): * cdef Py_ssize_t byte_count * if not PyString_CheckExact(self.bytes): # <<<<<<<<<<<<<< * raise AssertionError('self.bytes is not a string.') * byte_count = PyString_Size(self.bytes) */ __pyx_t_1 = (!PyString_CheckExact(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes)); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":315 * cdef Py_ssize_t byte_count * if not PyString_CheckExact(self.bytes): * raise AssertionError('self.bytes is not a string.') # <<<<<<<<<<<<<< * byte_count = PyString_Size(self.bytes) * self._cur_str = PyString_AsString(self.bytes) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_11)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); __pyx_t_3 = PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":316 * if not PyString_CheckExact(self.bytes): * raise AssertionError('self.bytes is not a string.') * byte_count = PyString_Size(self.bytes) # <<<<<<<<<<<<<< * self._cur_str = PyString_AsString(self.bytes) * # This points to the last character in the string */ __pyx_v_byte_count = PyString_Size(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":317 * raise AssertionError('self.bytes is not a string.') * byte_count = PyString_Size(self.bytes) * self._cur_str = PyString_AsString(self.bytes) # <<<<<<<<<<<<<< * # This points to the last character in the string * self._end_str = self._cur_str + byte_count */ __pyx_t_4 = PyString_AsString(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->bytes); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str = __pyx_t_4; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":319 * self._cur_str = PyString_AsString(self.bytes) * # This points to the last character in the string * self._end_str = self._cur_str + byte_count # <<<<<<<<<<<<<< * while self._cur_str < self._end_str: * self.process_line() */ ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_end_str = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str + __pyx_v_byte_count); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":320 * # This points to the last character in the string * self._end_str = self._cur_str + byte_count * while self._cur_str < self._end_str: # <<<<<<<<<<<<<< * self.process_line() * return self.keys */ while (1) { __pyx_t_1 = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_cur_str < ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->_end_str); if (!__pyx_t_1) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":321 * self._end_str = self._cur_str + byte_count * while self._cur_str < self._end_str: * self.process_line() # <<<<<<<<<<<<<< * return self.keys * */ __pyx_t_5 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->__pyx_vtab)->process_line(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":322 * while self._cur_str < self._end_str: * self.process_line() * return self.keys # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys); __pyx_r = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_v_self)->keys; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.BTreeLeafParser.parse"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":325 * * * def _parse_leaf_lines(bytes, key_length, ref_list_length): # <<<<<<<<<<<<<< * parser = BTreeLeafParser(bytes, key_length, ref_list_length) * return parser.parse() */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__parse_leaf_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__parse_leaf_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_bytes = 0; PyObject *__pyx_v_key_length = 0; PyObject *__pyx_v_ref_list_length = 0; struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *__pyx_v_parser; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bytes,&__pyx_n_s__key_length,&__pyx_n_s__ref_list_length,0}; __Pyx_RefNannySetupContext("_parse_leaf_lines"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bytes); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key_length); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_parse_leaf_lines", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref_list_length); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_parse_leaf_lines", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parse_leaf_lines") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_bytes = values[0]; __pyx_v_key_length = values[1]; __pyx_v_ref_list_length = values[2]; } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __pyx_v_bytes = PyTuple_GET_ITEM(__pyx_args, 0); __pyx_v_key_length = PyTuple_GET_ITEM(__pyx_args, 1); __pyx_v_ref_list_length = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_parse_leaf_lines", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._parse_leaf_lines"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_v_parser = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)Py_None); __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":326 * * def _parse_leaf_lines(bytes, key_length, ref_list_length): * parser = BTreeLeafParser(bytes, key_length, ref_list_length) # <<<<<<<<<<<<<< * return parser.parse() * */ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_bytes); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bytes); __Pyx_GIVEREF(__pyx_v_bytes); __Pyx_INCREF(__pyx_v_key_length); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_key_length); __Pyx_GIVEREF(__pyx_v_key_length); __Pyx_INCREF(__pyx_v_ref_list_length); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_ref_list_length); __Pyx_GIVEREF(__pyx_v_ref_list_length); __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_parser)); __pyx_v_parser = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)__pyx_t_2); __pyx_t_2 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":327 * def _parse_leaf_lines(bytes, key_length, ref_list_length): * parser = BTreeLeafParser(bytes, key_length, ref_list_length) * return parser.parse() # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_parser), __pyx_n_s__parse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._parse_leaf_lines"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_parser); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":349 * _hexbuf = '0123456789abcdef' * * cdef _populate_unhexbuf(): # <<<<<<<<<<<<<< * cdef int i * for i from 0 <= i < 256: */ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__populate_unhexbuf(void) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("_populate_unhexbuf"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":351 * cdef _populate_unhexbuf(): * cdef int i * for i from 0 <= i < 256: # <<<<<<<<<<<<<< * _unhexbuf[i] = -1 * for i from 0 <= i < 10: # 0123456789 => map to the raw number */ for (__pyx_v_i = 0; __pyx_v_i < 256; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":352 * cdef int i * for i from 0 <= i < 256: * _unhexbuf[i] = -1 # <<<<<<<<<<<<<< * for i from 0 <= i < 10: # 0123456789 => map to the raw number * _unhexbuf[(i + c'0')] = i */ (__pyx_v_6bzrlib_21_btree_serializer_pyx__unhexbuf[__pyx_v_i]) = -1; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":353 * for i from 0 <= i < 256: * _unhexbuf[i] = -1 * for i from 0 <= i < 10: # 0123456789 => map to the raw number # <<<<<<<<<<<<<< * _unhexbuf[(i + c'0')] = i * for i from 10 <= i < 16: # abcdef => 10, 11, 12, 13, 14, 15, 16 */ for (__pyx_v_i = 0; __pyx_v_i < 10; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":354 * _unhexbuf[i] = -1 * for i from 0 <= i < 10: # 0123456789 => map to the raw number * _unhexbuf[(i + c'0')] = i # <<<<<<<<<<<<<< * for i from 10 <= i < 16: # abcdef => 10, 11, 12, 13, 14, 15, 16 * _unhexbuf[(i - 10 + c'a')] = i */ (__pyx_v_6bzrlib_21_btree_serializer_pyx__unhexbuf[(__pyx_v_i + '0')]) = __pyx_v_i; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":355 * for i from 0 <= i < 10: # 0123456789 => map to the raw number * _unhexbuf[(i + c'0')] = i * for i from 10 <= i < 16: # abcdef => 10, 11, 12, 13, 14, 15, 16 # <<<<<<<<<<<<<< * _unhexbuf[(i - 10 + c'a')] = i * for i from 10 <= i < 16: # ABCDEF => 10, 11, 12, 13, 14, 15, 16 */ for (__pyx_v_i = 10; __pyx_v_i < 16; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":356 * _unhexbuf[(i + c'0')] = i * for i from 10 <= i < 16: # abcdef => 10, 11, 12, 13, 14, 15, 16 * _unhexbuf[(i - 10 + c'a')] = i # <<<<<<<<<<<<<< * for i from 10 <= i < 16: # ABCDEF => 10, 11, 12, 13, 14, 15, 16 * _unhexbuf[(i - 10 + c'A')] = i */ (__pyx_v_6bzrlib_21_btree_serializer_pyx__unhexbuf[((__pyx_v_i - 10) + 'a')]) = __pyx_v_i; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":357 * for i from 10 <= i < 16: # abcdef => 10, 11, 12, 13, 14, 15, 16 * _unhexbuf[(i - 10 + c'a')] = i * for i from 10 <= i < 16: # ABCDEF => 10, 11, 12, 13, 14, 15, 16 # <<<<<<<<<<<<<< * _unhexbuf[(i - 10 + c'A')] = i * _populate_unhexbuf() */ for (__pyx_v_i = 10; __pyx_v_i < 16; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":358 * _unhexbuf[(i - 10 + c'a')] = i * for i from 10 <= i < 16: # ABCDEF => 10, 11, 12, 13, 14, 15, 16 * _unhexbuf[(i - 10 + c'A')] = i # <<<<<<<<<<<<<< * _populate_unhexbuf() * */ (__pyx_v_6bzrlib_21_btree_serializer_pyx__unhexbuf[((__pyx_v_i - 10) + 'A')]) = __pyx_v_i; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":362 * * * cdef int _unhexlify_sha1(char *as_hex, char *as_bin): # cannot_raise # <<<<<<<<<<<<<< * """Take the hex sha1 in as_hex and make it binary in as_bin * */ static int __pyx_f_6bzrlib_21_btree_serializer_pyx__unhexlify_sha1(char *__pyx_v_as_hex, char *__pyx_v_as_bin) { int __pyx_v_top; int __pyx_v_bot; int __pyx_v_i; int __pyx_v_j; int __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("_unhexlify_sha1"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":374 * # binascii does this using isupper() and tolower() and ?: syntax. I'm * # guessing a simple lookup array should be faster. * j = 0 # <<<<<<<<<<<<<< * for i from 0 <= i < 20: * top = _unhexbuf[(as_hex[j])] */ __pyx_v_j = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":375 * # guessing a simple lookup array should be faster. * j = 0 * for i from 0 <= i < 20: # <<<<<<<<<<<<<< * top = _unhexbuf[(as_hex[j])] * j = j + 1 */ for (__pyx_v_i = 0; __pyx_v_i < 20; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":376 * j = 0 * for i from 0 <= i < 20: * top = _unhexbuf[(as_hex[j])] # <<<<<<<<<<<<<< * j = j + 1 * bot = _unhexbuf[(as_hex[j])] */ __pyx_v_top = (__pyx_v_6bzrlib_21_btree_serializer_pyx__unhexbuf[((unsigned char)(__pyx_v_as_hex[__pyx_v_j]))]); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":377 * for i from 0 <= i < 20: * top = _unhexbuf[(as_hex[j])] * j = j + 1 # <<<<<<<<<<<<<< * bot = _unhexbuf[(as_hex[j])] * j = j + 1 */ __pyx_v_j = (__pyx_v_j + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":378 * top = _unhexbuf[(as_hex[j])] * j = j + 1 * bot = _unhexbuf[(as_hex[j])] # <<<<<<<<<<<<<< * j = j + 1 * if top == -1 or bot == -1: */ __pyx_v_bot = (__pyx_v_6bzrlib_21_btree_serializer_pyx__unhexbuf[((unsigned char)(__pyx_v_as_hex[__pyx_v_j]))]); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":379 * j = j + 1 * bot = _unhexbuf[(as_hex[j])] * j = j + 1 # <<<<<<<<<<<<<< * if top == -1 or bot == -1: * return 0 */ __pyx_v_j = (__pyx_v_j + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":380 * bot = _unhexbuf[(as_hex[j])] * j = j + 1 * if top == -1 or bot == -1: # <<<<<<<<<<<<<< * return 0 * as_bin[i] = ((top << 4) + bot); */ __pyx_t_1 = (__pyx_v_top == -1); if (!__pyx_t_1) { __pyx_t_2 = (__pyx_v_bot == -1); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":381 * j = j + 1 * if top == -1 or bot == -1: * return 0 # <<<<<<<<<<<<<< * as_bin[i] = ((top << 4) + bot); * return 1 */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":382 * if top == -1 or bot == -1: * return 0 * as_bin[i] = ((top << 4) + bot); # <<<<<<<<<<<<<< * return 1 * */ (__pyx_v_as_bin[__pyx_v_i]) = ((unsigned char)((__pyx_v_top << 4) + __pyx_v_bot)); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":383 * return 0 * as_bin[i] = ((top << 4) + bot); * return 1 # <<<<<<<<<<<<<< * * */ __pyx_r = 1; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":386 * * * def _py_unhexlify(as_hex): # <<<<<<<<<<<<<< * """For the test infrastructure, just thunks to _unhexlify_sha1""" * if len(as_hex) != 40 or not PyString_CheckExact(as_hex): */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_unhexlify(PyObject *__pyx_self, PyObject *__pyx_v_as_hex); /*proto*/ static char __pyx_doc_6bzrlib_21_btree_serializer_pyx__py_unhexlify[] = "For the test infrastructure, just thunks to _unhexlify_sha1"; static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_unhexlify(PyObject *__pyx_self, PyObject *__pyx_v_as_hex) { PyObject *__pyx_v_as_bin; PyObject *__pyx_r = NULL; Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; __Pyx_RefNannySetupContext("_py_unhexlify"); __pyx_self = __pyx_self; __pyx_v_as_bin = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":388 * def _py_unhexlify(as_hex): * """For the test infrastructure, just thunks to _unhexlify_sha1""" * if len(as_hex) != 40 or not PyString_CheckExact(as_hex): # <<<<<<<<<<<<<< * raise ValueError('not a 40-byte hex digest') * as_bin = PyString_FromStringAndSize(NULL, 20) */ __pyx_t_1 = PyObject_Length(__pyx_v_as_hex); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 != 40); if (!__pyx_t_2) { __pyx_t_3 = (!PyString_CheckExact(__pyx_v_as_hex)); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } if (__pyx_t_4) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":389 * """For the test infrastructure, just thunks to _unhexlify_sha1""" * if len(as_hex) != 40 or not PyString_CheckExact(as_hex): * raise ValueError('not a 40-byte hex digest') # <<<<<<<<<<<<<< * as_bin = PyString_FromStringAndSize(NULL, 20) * if _unhexlify_sha1(PyString_AS_STRING(as_hex), PyString_AS_STRING(as_bin)): */ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_12)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12)); __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_6, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":390 * if len(as_hex) != 40 or not PyString_CheckExact(as_hex): * raise ValueError('not a 40-byte hex digest') * as_bin = PyString_FromStringAndSize(NULL, 20) # <<<<<<<<<<<<<< * if _unhexlify_sha1(PyString_AS_STRING(as_hex), PyString_AS_STRING(as_bin)): * return as_bin */ __pyx_t_6 = PyString_FromStringAndSize(NULL, 20); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_v_as_bin); __pyx_v_as_bin = __pyx_t_6; __pyx_t_6 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":391 * raise ValueError('not a 40-byte hex digest') * as_bin = PyString_FromStringAndSize(NULL, 20) * if _unhexlify_sha1(PyString_AS_STRING(as_hex), PyString_AS_STRING(as_bin)): # <<<<<<<<<<<<<< * return as_bin * return None */ __pyx_t_7 = __pyx_f_6bzrlib_21_btree_serializer_pyx__unhexlify_sha1(PyString_AS_STRING(__pyx_v_as_hex), PyString_AS_STRING(__pyx_v_as_bin)); if (__pyx_t_7) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":392 * as_bin = PyString_FromStringAndSize(NULL, 20) * if _unhexlify_sha1(PyString_AS_STRING(as_hex), PyString_AS_STRING(as_bin)): * return as_bin # <<<<<<<<<<<<<< * return None * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_as_bin); __pyx_r = __pyx_v_as_bin; goto __pyx_L0; goto __pyx_L6; } __pyx_L6:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":393 * if _unhexlify_sha1(PyString_AS_STRING(as_hex), PyString_AS_STRING(as_bin)): * return as_bin * return None # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._py_unhexlify"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_as_bin); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":396 * * * cdef void _hexlify_sha1(char *as_bin, char *as_hex): # cannot_raise # <<<<<<<<<<<<<< * cdef int i, j * cdef char c */ static void __pyx_f_6bzrlib_21_btree_serializer_pyx__hexlify_sha1(char *__pyx_v_as_bin, char *__pyx_v_as_hex) { int __pyx_v_i; int __pyx_v_j; char __pyx_v_c; __Pyx_RefNannySetupContext("_hexlify_sha1"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":400 * cdef char c * * j = 0 # <<<<<<<<<<<<<< * for i from 0 <= i < 20: * c = as_bin[i] */ __pyx_v_j = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":401 * * j = 0 * for i from 0 <= i < 20: # <<<<<<<<<<<<<< * c = as_bin[i] * as_hex[j] = _hexbuf[(c>>4)&0xf] */ for (__pyx_v_i = 0; __pyx_v_i < 20; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":402 * j = 0 * for i from 0 <= i < 20: * c = as_bin[i] # <<<<<<<<<<<<<< * as_hex[j] = _hexbuf[(c>>4)&0xf] * j = j + 1 */ __pyx_v_c = (__pyx_v_as_bin[__pyx_v_i]); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":403 * for i from 0 <= i < 20: * c = as_bin[i] * as_hex[j] = _hexbuf[(c>>4)&0xf] # <<<<<<<<<<<<<< * j = j + 1 * as_hex[j] = _hexbuf[(c)&0xf] */ (__pyx_v_as_hex[__pyx_v_j]) = (__pyx_v_6bzrlib_21_btree_serializer_pyx__hexbuf[((__pyx_v_c >> 4) & 0xf)]); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":404 * c = as_bin[i] * as_hex[j] = _hexbuf[(c>>4)&0xf] * j = j + 1 # <<<<<<<<<<<<<< * as_hex[j] = _hexbuf[(c)&0xf] * j = j + 1 */ __pyx_v_j = (__pyx_v_j + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":405 * as_hex[j] = _hexbuf[(c>>4)&0xf] * j = j + 1 * as_hex[j] = _hexbuf[(c)&0xf] # <<<<<<<<<<<<<< * j = j + 1 * */ (__pyx_v_as_hex[__pyx_v_j]) = (__pyx_v_6bzrlib_21_btree_serializer_pyx__hexbuf[(__pyx_v_c & 0xf)]); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":406 * j = j + 1 * as_hex[j] = _hexbuf[(c)&0xf] * j = j + 1 # <<<<<<<<<<<<<< * * */ __pyx_v_j = (__pyx_v_j + 1); } __Pyx_RefNannyFinishContext(); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":409 * * * def _py_hexlify(as_bin): # <<<<<<<<<<<<<< * """For test infrastructure, thunk to _hexlify_sha1""" * if len(as_bin) != 20 or not PyString_CheckExact(as_bin): */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_hexlify(PyObject *__pyx_self, PyObject *__pyx_v_as_bin); /*proto*/ static char __pyx_doc_6bzrlib_21_btree_serializer_pyx__py_hexlify[] = "For test infrastructure, thunk to _hexlify_sha1"; static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_hexlify(PyObject *__pyx_self, PyObject *__pyx_v_as_bin) { PyObject *__pyx_v_as_hex; PyObject *__pyx_r = NULL; Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("_py_hexlify"); __pyx_self = __pyx_self; __pyx_v_as_hex = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":411 * def _py_hexlify(as_bin): * """For test infrastructure, thunk to _hexlify_sha1""" * if len(as_bin) != 20 or not PyString_CheckExact(as_bin): # <<<<<<<<<<<<<< * raise ValueError('not a 20-byte binary digest') * as_hex = PyString_FromStringAndSize(NULL, 40) */ __pyx_t_1 = PyObject_Length(__pyx_v_as_bin); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 != 20); if (!__pyx_t_2) { __pyx_t_3 = (!PyString_CheckExact(__pyx_v_as_bin)); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } if (__pyx_t_4) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":412 * """For test infrastructure, thunk to _hexlify_sha1""" * if len(as_bin) != 20 or not PyString_CheckExact(as_bin): * raise ValueError('not a 20-byte binary digest') # <<<<<<<<<<<<<< * as_hex = PyString_FromStringAndSize(NULL, 40) * _hexlify_sha1(PyString_AS_STRING(as_bin), PyString_AS_STRING(as_hex)) */ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13)); __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_6, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":413 * if len(as_bin) != 20 or not PyString_CheckExact(as_bin): * raise ValueError('not a 20-byte binary digest') * as_hex = PyString_FromStringAndSize(NULL, 40) # <<<<<<<<<<<<<< * _hexlify_sha1(PyString_AS_STRING(as_bin), PyString_AS_STRING(as_hex)) * return as_hex */ __pyx_t_6 = PyString_FromStringAndSize(NULL, 40); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_v_as_hex); __pyx_v_as_hex = __pyx_t_6; __pyx_t_6 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":414 * raise ValueError('not a 20-byte binary digest') * as_hex = PyString_FromStringAndSize(NULL, 40) * _hexlify_sha1(PyString_AS_STRING(as_bin), PyString_AS_STRING(as_hex)) # <<<<<<<<<<<<<< * return as_hex * */ __pyx_f_6bzrlib_21_btree_serializer_pyx__hexlify_sha1(PyString_AS_STRING(__pyx_v_as_bin), PyString_AS_STRING(__pyx_v_as_hex)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":415 * as_hex = PyString_FromStringAndSize(NULL, 40) * _hexlify_sha1(PyString_AS_STRING(as_bin), PyString_AS_STRING(as_hex)) * return as_hex # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_as_hex); __pyx_r = __pyx_v_as_hex; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._py_hexlify"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_as_hex); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":418 * * * cdef int _key_to_sha1(key, char *sha1): # cannot_raise # <<<<<<<<<<<<<< * """Map a key into its sha1 content. * */ static int __pyx_f_6bzrlib_21_btree_serializer_pyx__key_to_sha1(PyObject *__pyx_v_key, char *__pyx_v_sha1) { char *__pyx_v_c_val; PyObject *__pyx_v_p_val; int __pyx_r; int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("_key_to_sha1"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":428 * cdef PyObject *p_val * * if StaticTuple_CheckExact(key) and StaticTuple_GET_SIZE(key) == 1: # <<<<<<<<<<<<<< * p_val = StaticTuple_GET_ITEM(key, 0) * elif (PyTuple_CheckExact(key) and PyTuple_GET_SIZE(key) == 1): */ if (StaticTuple_CheckExact(__pyx_v_key)) { if (!(likely(((__pyx_v_key) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_key, __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (StaticTuple_GET_SIZE(((StaticTuple *)__pyx_v_key)) == 1); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = StaticTuple_CheckExact(__pyx_v_key); } if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":429 * * if StaticTuple_CheckExact(key) and StaticTuple_GET_SIZE(key) == 1: * p_val = StaticTuple_GET_ITEM(key, 0) # <<<<<<<<<<<<<< * elif (PyTuple_CheckExact(key) and PyTuple_GET_SIZE(key) == 1): * p_val = PyTuple_GET_ITEM_ptr_object(key, 0) */ if (!(likely(((__pyx_v_key) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_key, __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_p_val = ((PyObject *)StaticTuple_GET_ITEM(((StaticTuple *)__pyx_v_key), 0)); goto __pyx_L3; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":430 * if StaticTuple_CheckExact(key) and StaticTuple_GET_SIZE(key) == 1: * p_val = StaticTuple_GET_ITEM(key, 0) * elif (PyTuple_CheckExact(key) and PyTuple_GET_SIZE(key) == 1): # <<<<<<<<<<<<<< * p_val = PyTuple_GET_ITEM_ptr_object(key, 0) * else: */ if (PyTuple_CheckExact(__pyx_v_key)) { __pyx_t_2 = (PyTuple_GET_SIZE(__pyx_v_key) == 1); __pyx_t_1 = __pyx_t_2; } else { __pyx_t_1 = PyTuple_CheckExact(__pyx_v_key); } if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":431 * p_val = StaticTuple_GET_ITEM(key, 0) * elif (PyTuple_CheckExact(key) and PyTuple_GET_SIZE(key) == 1): * p_val = PyTuple_GET_ITEM_ptr_object(key, 0) # <<<<<<<<<<<<<< * else: * # Not a tuple or a StaticTuple */ __pyx_v_p_val = PyTuple_GET_ITEM(__pyx_v_key, 0); goto __pyx_L3; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":434 * else: * # Not a tuple or a StaticTuple * return 0 # <<<<<<<<<<<<<< * if (PyString_CheckExact_ptr(p_val) and PyString_GET_SIZE_ptr(p_val) == 45): * c_val = PyString_AS_STRING_ptr(p_val) */ __pyx_r = 0; goto __pyx_L0; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":435 * # Not a tuple or a StaticTuple * return 0 * if (PyString_CheckExact_ptr(p_val) and PyString_GET_SIZE_ptr(p_val) == 45): # <<<<<<<<<<<<<< * c_val = PyString_AS_STRING_ptr(p_val) * else: */ if (PyString_CheckExact(__pyx_v_p_val)) { __pyx_t_1 = (PyString_GET_SIZE(__pyx_v_p_val) == 45); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = PyString_CheckExact(__pyx_v_p_val); } if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":436 * return 0 * if (PyString_CheckExact_ptr(p_val) and PyString_GET_SIZE_ptr(p_val) == 45): * c_val = PyString_AS_STRING_ptr(p_val) # <<<<<<<<<<<<<< * else: * return 0 */ __pyx_v_c_val = PyString_AS_STRING(__pyx_v_p_val); goto __pyx_L4; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":438 * c_val = PyString_AS_STRING_ptr(p_val) * else: * return 0 # <<<<<<<<<<<<<< * if strncmp(c_val, 'sha1:', 5) != 0: * return 0 */ __pyx_r = 0; goto __pyx_L0; } __pyx_L4:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":439 * else: * return 0 * if strncmp(c_val, 'sha1:', 5) != 0: # <<<<<<<<<<<<<< * return 0 * if not _unhexlify_sha1(c_val + 5, sha1): */ __pyx_t_2 = (strncmp(__pyx_v_c_val, __pyx_k_3, 5) != 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":440 * return 0 * if strncmp(c_val, 'sha1:', 5) != 0: * return 0 # <<<<<<<<<<<<<< * if not _unhexlify_sha1(c_val + 5, sha1): * return 0 */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":441 * if strncmp(c_val, 'sha1:', 5) != 0: * return 0 * if not _unhexlify_sha1(c_val + 5, sha1): # <<<<<<<<<<<<<< * return 0 * return 1 */ __pyx_t_2 = (!__pyx_f_6bzrlib_21_btree_serializer_pyx__unhexlify_sha1((__pyx_v_c_val + 5), __pyx_v_sha1)); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":442 * return 0 * if not _unhexlify_sha1(c_val + 5, sha1): * return 0 # <<<<<<<<<<<<<< * return 1 * */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L6; } __pyx_L6:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":443 * if not _unhexlify_sha1(c_val + 5, sha1): * return 0 * return 1 # <<<<<<<<<<<<<< * * */ __pyx_r = 1; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("bzrlib._btree_serializer_pyx._key_to_sha1"); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":446 * * * def _py_key_to_sha1(key): # <<<<<<<<<<<<<< * """Map a key to a simple sha1 string. * */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_key_to_sha1(PyObject *__pyx_self, PyObject *__pyx_v_key); /*proto*/ static char __pyx_doc_6bzrlib_21_btree_serializer_pyx__py_key_to_sha1[] = "Map a key to a simple sha1 string.\n\n This is a testing thunk to the C function.\n "; static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_key_to_sha1(PyObject *__pyx_self, PyObject *__pyx_v_key) { PyObject *__pyx_v_as_bin_sha; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; __Pyx_RefNannySetupContext("_py_key_to_sha1"); __pyx_self = __pyx_self; __pyx_v_as_bin_sha = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":451 * This is a testing thunk to the C function. * """ * as_bin_sha = PyString_FromStringAndSize(NULL, 20) # <<<<<<<<<<<<<< * if _key_to_sha1(key, PyString_AS_STRING(as_bin_sha)): * return as_bin_sha */ __pyx_t_1 = PyString_FromStringAndSize(NULL, 20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_as_bin_sha); __pyx_v_as_bin_sha = __pyx_t_1; __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":452 * """ * as_bin_sha = PyString_FromStringAndSize(NULL, 20) * if _key_to_sha1(key, PyString_AS_STRING(as_bin_sha)): # <<<<<<<<<<<<<< * return as_bin_sha * return None */ __pyx_t_2 = __pyx_f_6bzrlib_21_btree_serializer_pyx__key_to_sha1(__pyx_v_key, PyString_AS_STRING(__pyx_v_as_bin_sha)); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":453 * as_bin_sha = PyString_FromStringAndSize(NULL, 20) * if _key_to_sha1(key, PyString_AS_STRING(as_bin_sha)): * return as_bin_sha # <<<<<<<<<<<<<< * return None * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_as_bin_sha); __pyx_r = __pyx_v_as_bin_sha; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":454 * if _key_to_sha1(key, PyString_AS_STRING(as_bin_sha)): * return as_bin_sha * return None # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._py_key_to_sha1"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_as_bin_sha); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":457 * * * cdef StaticTuple _sha1_to_key(char *sha1): # <<<<<<<<<<<<<< * """Compute a ('sha1:abcd',) key for a given sha1.""" * cdef StaticTuple key */ static StaticTuple *__pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_key(char *__pyx_v_sha1) { StaticTuple *__pyx_v_key; PyObject *__pyx_v_hexxed; char *__pyx_v_c_buf; StaticTuple *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_sha1_to_key"); __pyx_v_key = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_hexxed = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":462 * cdef object hexxed * cdef char *c_buf * hexxed = PyString_FromStringAndSize(NULL, 45) # <<<<<<<<<<<<<< * c_buf = PyString_AS_STRING(hexxed) * memcpy(c_buf, 'sha1:', 5) */ __pyx_t_1 = PyString_FromStringAndSize(NULL, 45); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_hexxed); __pyx_v_hexxed = __pyx_t_1; __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":463 * cdef char *c_buf * hexxed = PyString_FromStringAndSize(NULL, 45) * c_buf = PyString_AS_STRING(hexxed) # <<<<<<<<<<<<<< * memcpy(c_buf, 'sha1:', 5) * _hexlify_sha1(sha1, c_buf+5) */ __pyx_v_c_buf = PyString_AS_STRING(__pyx_v_hexxed); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":464 * hexxed = PyString_FromStringAndSize(NULL, 45) * c_buf = PyString_AS_STRING(hexxed) * memcpy(c_buf, 'sha1:', 5) # <<<<<<<<<<<<<< * _hexlify_sha1(sha1, c_buf+5) * key = StaticTuple_New(1) */ memcpy(__pyx_v_c_buf, __pyx_k_3, 5); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":465 * c_buf = PyString_AS_STRING(hexxed) * memcpy(c_buf, 'sha1:', 5) * _hexlify_sha1(sha1, c_buf+5) # <<<<<<<<<<<<<< * key = StaticTuple_New(1) * Py_INCREF(hexxed) */ __pyx_f_6bzrlib_21_btree_serializer_pyx__hexlify_sha1(__pyx_v_sha1, (__pyx_v_c_buf + 5)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":466 * memcpy(c_buf, 'sha1:', 5) * _hexlify_sha1(sha1, c_buf+5) * key = StaticTuple_New(1) # <<<<<<<<<<<<<< * Py_INCREF(hexxed) * StaticTuple_SET_ITEM(key, 0, hexxed) */ __pyx_t_1 = ((PyObject *)StaticTuple_New(1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_key)); __pyx_v_key = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":467 * _hexlify_sha1(sha1, c_buf+5) * key = StaticTuple_New(1) * Py_INCREF(hexxed) # <<<<<<<<<<<<<< * StaticTuple_SET_ITEM(key, 0, hexxed) * # This is a bit expensive. To parse 120 keys takes 48us, to return them all */ Py_INCREF(__pyx_v_hexxed); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":468 * key = StaticTuple_New(1) * Py_INCREF(hexxed) * StaticTuple_SET_ITEM(key, 0, hexxed) # <<<<<<<<<<<<<< * # This is a bit expensive. To parse 120 keys takes 48us, to return them all * # can be done in 66.6us (so 18.6us to build them all). */ StaticTuple_SET_ITEM(__pyx_v_key, 0, __pyx_v_hexxed); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":478 * # We *could* hang the PyObject form off of the gc_chk_sha1_record for ones * # that we have deserialized. Something to think about, at least. * key = StaticTuple_Intern(key) # <<<<<<<<<<<<<< * return key * */ __pyx_t_1 = ((PyObject *)StaticTuple_Intern(__pyx_v_key)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_key)); __pyx_v_key = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":479 * # that we have deserialized. Something to think about, at least. * key = StaticTuple_Intern(key) * return key # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_key)); __pyx_r = __pyx_v_key; goto __pyx_L0; __pyx_r = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._sha1_to_key"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_key); __Pyx_DECREF(__pyx_v_hexxed); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":482 * * * def _py_sha1_to_key(sha1_bin): # <<<<<<<<<<<<<< * """Test thunk to check the sha1 mapping.""" * if not PyString_CheckExact(sha1_bin) or PyString_GET_SIZE(sha1_bin) != 20: */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_sha1_to_key(PyObject *__pyx_self, PyObject *__pyx_v_sha1_bin); /*proto*/ static char __pyx_doc_6bzrlib_21_btree_serializer_pyx__py_sha1_to_key[] = "Test thunk to check the sha1 mapping."; static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_sha1_to_key(PyObject *__pyx_self, PyObject *__pyx_v_sha1_bin) { PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("_py_sha1_to_key"); __pyx_self = __pyx_self; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":484 * def _py_sha1_to_key(sha1_bin): * """Test thunk to check the sha1 mapping.""" * if not PyString_CheckExact(sha1_bin) or PyString_GET_SIZE(sha1_bin) != 20: # <<<<<<<<<<<<<< * raise ValueError('sha1_bin must be a str of exactly 20 bytes') * return _sha1_to_key(PyString_AS_STRING(sha1_bin)) */ __pyx_t_1 = (!PyString_CheckExact(__pyx_v_sha1_bin)); if (!__pyx_t_1) { __pyx_t_2 = (PyString_GET_SIZE(__pyx_v_sha1_bin) != 20); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":485 * """Test thunk to check the sha1 mapping.""" * if not PyString_CheckExact(sha1_bin) or PyString_GET_SIZE(sha1_bin) != 20: * raise ValueError('sha1_bin must be a str of exactly 20 bytes') # <<<<<<<<<<<<<< * return _sha1_to_key(PyString_AS_STRING(sha1_bin)) * */ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_14)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":486 * if not PyString_CheckExact(sha1_bin) or PyString_GET_SIZE(sha1_bin) != 20: * raise ValueError('sha1_bin must be a str of exactly 20 bytes') * return _sha1_to_key(PyString_AS_STRING(sha1_bin)) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = ((PyObject *)__pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_key(PyString_AS_STRING(__pyx_v_sha1_bin))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._py_sha1_to_key"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":489 * * * cdef unsigned int _sha1_to_uint(char *sha1): # cannot_raise # <<<<<<<<<<<<<< * cdef unsigned int val * # Must be in MSB, because that is how the content is sorted */ static unsigned int __pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_uint(char *__pyx_v_sha1) { unsigned int __pyx_v_val; unsigned int __pyx_r; __Pyx_RefNannySetupContext("_sha1_to_uint"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":495 * | (((sha1[1]) & 0xff) << 16) * | (((sha1[2]) & 0xff) << 8) * | (((sha1[3]) & 0xff) << 0)) # <<<<<<<<<<<<<< * return val * */ __pyx_v_val = (((((((unsigned int)(__pyx_v_sha1[0])) & 0xff) << 24) | ((((unsigned int)(__pyx_v_sha1[1])) & 0xff) << 16)) | ((((unsigned int)(__pyx_v_sha1[2])) & 0xff) << 8)) | ((((unsigned int)(__pyx_v_sha1[3])) & 0xff) << 0)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":496 * | (((sha1[2]) & 0xff) << 8) * | (((sha1[3]) & 0xff) << 0)) * return val # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_val; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":499 * * * cdef _format_record(gc_chk_sha1_record *record): # <<<<<<<<<<<<<< * # This is inefficient to go from a logical state back to a * # string, but it makes things work a bit better internally for now. */ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx__format_record(__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_v_record) { PyObject *__pyx_v_block_offset_str; PyObject *__pyx_v_value; PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("_format_record"); __pyx_v_block_offset_str = Py_None; __Pyx_INCREF(Py_None); __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":502 * # This is inefficient to go from a logical state back to a * # string, but it makes things work a bit better internally for now. * if record.block_offset >= 0xFFFFFFFF: # <<<<<<<<<<<<<< * # %llu is what we really want, but unfortunately it was only added * # in python 2.7... :( */ __pyx_t_1 = (__pyx_v_record->block_offset >= 0xFFFFFFFF); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":505 * # %llu is what we really want, but unfortunately it was only added * # in python 2.7... :( * block_offset_str = str(record.block_offset) # <<<<<<<<<<<<<< * value = PyString_FromFormat('%s %u %u %u', * PyString_AS_STRING(block_offset_str), */ __pyx_t_2 = PyLong_FromLongLong(__pyx_v_record->block_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_block_offset_str); __pyx_v_block_offset_str = __pyx_t_2; __pyx_t_2 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":509 * PyString_AS_STRING(block_offset_str), * record.block_length, * record.record_start, record.record_end) # <<<<<<<<<<<<<< * else: * value = PyString_FromFormat('%lu %u %u %u', */ __pyx_t_2 = PyString_FromFormat(__pyx_k_15, PyString_AS_STRING(__pyx_v_block_offset_str), __pyx_v_record->block_length, __pyx_v_record->record_start, __pyx_v_record->record_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_value); __pyx_v_value = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L3; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":514 * record.block_offset, * record.block_length, * record.record_start, record.record_end) # <<<<<<<<<<<<<< * return value * */ __pyx_t_2 = PyString_FromFormat(__pyx_k_16, ((unsigned long)__pyx_v_record->block_offset), __pyx_v_record->block_length, __pyx_v_record->record_start, __pyx_v_record->record_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_value); __pyx_v_value = __pyx_t_2; __pyx_t_2 = 0; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":515 * record.block_length, * record.record_start, record.record_end) * return value # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_value); __pyx_r = __pyx_v_value; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._format_record"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_block_offset_str); __Pyx_DECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":522 * * cdef gc_chk_sha1_record *records * cdef public object last_key # <<<<<<<<<<<<<< * cdef gc_chk_sha1_record *last_record * cdef public int num_records */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannySetupContext("__get__"); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); __pyx_r = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannySetupContext("__set__"); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_GOTREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); __Pyx_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannySetupContext("__del__"); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); __Pyx_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":524 * cdef public object last_key * cdef gc_chk_sha1_record *last_record * cdef public int num_records # <<<<<<<<<<<<<< * # This is the number of bits to shift to get to the interesting byte. A * # value of 24 means that the very first byte changes across all keys. */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_11num_records___get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_11num_records___get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.num_records.__get__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_11num_records___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_11num_records___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; int __pyx_t_1; __Pyx_RefNannySetupContext("__set__"); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records = __pyx_t_1; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.num_records.__set__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":530 * # ignore. 0 means that at least the first 3 bytes are identical, though * # that is going to be very rare * cdef public unsigned char common_shift # <<<<<<<<<<<<<< * # This maps an interesting byte to the first record that matches. * # Equivalent to bisect.bisect_left(self.records, sha1), though only taking */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_12common_shift___get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_12common_shift___get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->common_shift); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.common_shift.__get__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_12common_shift___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_12common_shift___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; unsigned char __pyx_t_1; __Pyx_RefNannySetupContext("__set__"); __pyx_t_1 = __Pyx_PyInt_AsUnsignedChar(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->common_shift = __pyx_t_1; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.common_shift.__set__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":536 * cdef unsigned char offsets[257] * * def __sizeof__(self): # <<<<<<<<<<<<<< * # :( Why doesn't Pyrex let me do a simple sizeof(GCCHKSHA1LeafNode) * # like Cython? Explicitly enumerating everything here seems to leave my */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___sizeof__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___sizeof__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__sizeof__"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":546 * # return (sizeof(GCCHKSHA1LeafNode) * # + sizeof(gc_chk_sha1_record)*self.num_records) * return (sizeof(PyObject) + sizeof(void*) + sizeof(int) # <<<<<<<<<<<<<< * + sizeof(gc_chk_sha1_record*) + sizeof(PyObject *) * + sizeof(gc_chk_sha1_record*) + sizeof(char) */ __Pyx_XDECREF(__pyx_r); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":550 * + sizeof(gc_chk_sha1_record*) + sizeof(char) * + sizeof(unsigned char)*257 * + sizeof(gc_chk_sha1_record)*self.num_records) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __pyx_t_1 = __Pyx_PyInt_FromSize_t((((((((((sizeof(PyObject)) + (sizeof(void *))) + (sizeof(int))) + (sizeof(__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *))) + (sizeof(PyObject *))) + (sizeof(__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *))) + (sizeof(char))) + ((sizeof(unsigned char)) * 257)) + ((sizeof(__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record)) * ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.__sizeof__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":552 * + sizeof(gc_chk_sha1_record)*self.num_records) * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self.records != NULL: * PyMem_Free(self.records) */ static void __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___dealloc__(PyObject *__pyx_v_self) { int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":553 * * def __dealloc__(self): * if self.records != NULL: # <<<<<<<<<<<<<< * PyMem_Free(self.records) * self.records = NULL */ __pyx_t_1 = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->records != NULL); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":554 * def __dealloc__(self): * if self.records != NULL: * PyMem_Free(self.records) # <<<<<<<<<<<<<< * self.records = NULL * */ PyMem_Free(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->records); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":555 * if self.records != NULL: * PyMem_Free(self.records) * self.records = NULL # <<<<<<<<<<<<<< * * def __init__(self, bytes): */ ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->records = NULL; goto __pyx_L5; } __pyx_L5:; __Pyx_RefNannyFinishContext(); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":557 * self.records = NULL * * def __init__(self, bytes): # <<<<<<<<<<<<<< * self._parse_bytes(bytes) * self.last_key = None */ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_bytes = 0; int __pyx_r; PyObject *__pyx_t_1 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bytes,0}; __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bytes); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_bytes = values[0]; } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { __pyx_v_bytes = PyTuple_GET_ITEM(__pyx_args, 0); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.__init__"); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":558 * * def __init__(self, bytes): * self._parse_bytes(bytes) # <<<<<<<<<<<<<< * self.last_key = None * self.last_record = NULL */ __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->__pyx_vtab)->_parse_bytes(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self), __pyx_v_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":559 * def __init__(self, bytes): * self._parse_bytes(bytes) * self.last_key = None # <<<<<<<<<<<<<< * self.last_record = NULL * */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); __Pyx_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key = Py_None; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":560 * self._parse_bytes(bytes) * self.last_key = None * self.last_record = NULL # <<<<<<<<<<<<<< * * property min_key: */ ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_record = NULL; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.__init__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":563 * * property min_key: * def __get__(self): # <<<<<<<<<<<<<< * if self.num_records > 0: * return _sha1_to_key(self.records[0].sha1) */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_7min_key___get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_7min_key___get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__get__"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":564 * property min_key: * def __get__(self): * if self.num_records > 0: # <<<<<<<<<<<<<< * return _sha1_to_key(self.records[0].sha1) * return None */ __pyx_t_1 = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records > 0); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":565 * def __get__(self): * if self.num_records > 0: * return _sha1_to_key(self.records[0].sha1) # <<<<<<<<<<<<<< * return None * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_key((((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->records[0]).sha1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":566 * if self.num_records > 0: * return _sha1_to_key(self.records[0].sha1) * return None # <<<<<<<<<<<<<< * * property max_key: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.min_key.__get__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":569 * * property max_key: * def __get__(self): # <<<<<<<<<<<<<< * if self.num_records > 0: * return _sha1_to_key(self.records[self.num_records-1].sha1) */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_7max_key___get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_7max_key___get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__get__"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":570 * property max_key: * def __get__(self): * if self.num_records > 0: # <<<<<<<<<<<<<< * return _sha1_to_key(self.records[self.num_records-1].sha1) * return None */ __pyx_t_1 = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records > 0); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":571 * def __get__(self): * if self.num_records > 0: * return _sha1_to_key(self.records[self.num_records-1].sha1) # <<<<<<<<<<<<<< * return None * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_key((((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->records[(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records - 1)]).sha1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":572 * if self.num_records > 0: * return _sha1_to_key(self.records[self.num_records-1].sha1) * return None # <<<<<<<<<<<<<< * * cdef StaticTuple _record_to_value_and_refs(self, */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.max_key.__get__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":574 * return None * * cdef StaticTuple _record_to_value_and_refs(self, # <<<<<<<<<<<<<< * gc_chk_sha1_record *record): * """Extract the refs and value part of this record.""" */ static StaticTuple *__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__record_to_value_and_refs(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_v_record) { StaticTuple *__pyx_v_value_and_refs; StaticTuple *__pyx_v_empty; PyObject *__pyx_v_value; StaticTuple *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_record_to_value_and_refs"); __pyx_v_value_and_refs = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_empty = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":579 * cdef StaticTuple value_and_refs * cdef StaticTuple empty * value_and_refs = StaticTuple_New(2) # <<<<<<<<<<<<<< * value = _format_record(record) * Py_INCREF(value) */ __pyx_t_1 = ((PyObject *)StaticTuple_New(2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_value_and_refs)); __pyx_v_value_and_refs = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":580 * cdef StaticTuple empty * value_and_refs = StaticTuple_New(2) * value = _format_record(record) # <<<<<<<<<<<<<< * Py_INCREF(value) * StaticTuple_SET_ITEM(value_and_refs, 0, value) */ __pyx_t_1 = __pyx_f_6bzrlib_21_btree_serializer_pyx__format_record(__pyx_v_record); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_value); __pyx_v_value = __pyx_t_1; __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":581 * value_and_refs = StaticTuple_New(2) * value = _format_record(record) * Py_INCREF(value) # <<<<<<<<<<<<<< * StaticTuple_SET_ITEM(value_and_refs, 0, value) * # Always empty refs */ Py_INCREF(__pyx_v_value); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":582 * value = _format_record(record) * Py_INCREF(value) * StaticTuple_SET_ITEM(value_and_refs, 0, value) # <<<<<<<<<<<<<< * # Always empty refs * empty = StaticTuple_New(0) */ StaticTuple_SET_ITEM(__pyx_v_value_and_refs, 0, __pyx_v_value); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":584 * StaticTuple_SET_ITEM(value_and_refs, 0, value) * # Always empty refs * empty = StaticTuple_New(0) # <<<<<<<<<<<<<< * Py_INCREF(empty) * StaticTuple_SET_ITEM(value_and_refs, 1, empty) */ __pyx_t_1 = ((PyObject *)StaticTuple_New(0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_empty)); __pyx_v_empty = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":585 * # Always empty refs * empty = StaticTuple_New(0) * Py_INCREF(empty) # <<<<<<<<<<<<<< * StaticTuple_SET_ITEM(value_and_refs, 1, empty) * return value_and_refs */ Py_INCREF(((PyObject *)__pyx_v_empty)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":586 * empty = StaticTuple_New(0) * Py_INCREF(empty) * StaticTuple_SET_ITEM(value_and_refs, 1, empty) # <<<<<<<<<<<<<< * return value_and_refs * */ StaticTuple_SET_ITEM(__pyx_v_value_and_refs, 1, ((PyObject *)__pyx_v_empty)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":587 * Py_INCREF(empty) * StaticTuple_SET_ITEM(value_and_refs, 1, empty) * return value_and_refs # <<<<<<<<<<<<<< * * cdef StaticTuple _record_to_item(self, gc_chk_sha1_record *record): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_value_and_refs)); __pyx_r = __pyx_v_value_and_refs; goto __pyx_L0; __pyx_r = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._record_to_value_and_refs"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_value_and_refs); __Pyx_DECREF((PyObject *)__pyx_v_empty); __Pyx_DECREF(__pyx_v_value); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":589 * return value_and_refs * * cdef StaticTuple _record_to_item(self, gc_chk_sha1_record *record): # <<<<<<<<<<<<<< * """Turn a given record back into a fully fledged item. * """ */ static StaticTuple *__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__record_to_item(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_v_record) { StaticTuple *__pyx_v_item; StaticTuple *__pyx_v_key; StaticTuple *__pyx_v_value_and_refs; StaticTuple *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_record_to_item"); __pyx_v_item = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_key = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_value_and_refs = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":596 * cdef StaticTuple value_and_refs * cdef object value * key = _sha1_to_key(record.sha1) # <<<<<<<<<<<<<< * item = StaticTuple_New(2) * Py_INCREF(key) */ __pyx_t_1 = ((PyObject *)__pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_key(__pyx_v_record->sha1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_key)); __pyx_v_key = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":597 * cdef object value * key = _sha1_to_key(record.sha1) * item = StaticTuple_New(2) # <<<<<<<<<<<<<< * Py_INCREF(key) * StaticTuple_SET_ITEM(item, 0, key) */ __pyx_t_1 = ((PyObject *)StaticTuple_New(2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_item)); __pyx_v_item = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":598 * key = _sha1_to_key(record.sha1) * item = StaticTuple_New(2) * Py_INCREF(key) # <<<<<<<<<<<<<< * StaticTuple_SET_ITEM(item, 0, key) * value_and_refs = self._record_to_value_and_refs(record) */ Py_INCREF(((PyObject *)__pyx_v_key)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":599 * item = StaticTuple_New(2) * Py_INCREF(key) * StaticTuple_SET_ITEM(item, 0, key) # <<<<<<<<<<<<<< * value_and_refs = self._record_to_value_and_refs(record) * Py_INCREF(value_and_refs) */ StaticTuple_SET_ITEM(__pyx_v_item, 0, ((PyObject *)__pyx_v_key)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":600 * Py_INCREF(key) * StaticTuple_SET_ITEM(item, 0, key) * value_and_refs = self._record_to_value_and_refs(record) # <<<<<<<<<<<<<< * Py_INCREF(value_and_refs) * StaticTuple_SET_ITEM(item, 1, value_and_refs) */ __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self->__pyx_vtab)->_record_to_value_and_refs(__pyx_v_self, __pyx_v_record)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_value_and_refs)); __pyx_v_value_and_refs = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":601 * StaticTuple_SET_ITEM(item, 0, key) * value_and_refs = self._record_to_value_and_refs(record) * Py_INCREF(value_and_refs) # <<<<<<<<<<<<<< * StaticTuple_SET_ITEM(item, 1, value_and_refs) * return item */ Py_INCREF(((PyObject *)__pyx_v_value_and_refs)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":602 * value_and_refs = self._record_to_value_and_refs(record) * Py_INCREF(value_and_refs) * StaticTuple_SET_ITEM(item, 1, value_and_refs) # <<<<<<<<<<<<<< * return item * */ StaticTuple_SET_ITEM(__pyx_v_item, 1, ((PyObject *)__pyx_v_value_and_refs)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":603 * Py_INCREF(value_and_refs) * StaticTuple_SET_ITEM(item, 1, value_and_refs) * return item # <<<<<<<<<<<<<< * * cdef gc_chk_sha1_record* _lookup_record(self, char *sha1) except? NULL: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_item)); __pyx_r = __pyx_v_item; goto __pyx_L0; __pyx_r = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._record_to_item"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_item); __Pyx_DECREF((PyObject *)__pyx_v_key); __Pyx_DECREF((PyObject *)__pyx_v_value_and_refs); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":605 * return item * * cdef gc_chk_sha1_record* _lookup_record(self, char *sha1) except? NULL: # <<<<<<<<<<<<<< * """Find a gc_chk_sha1_record that matches the sha1 supplied.""" * cdef int lo, hi, mid, the_cmp */ static __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__lookup_record(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self, char *__pyx_v_sha1) { int __pyx_v_lo; int __pyx_v_hi; int __pyx_v_mid; int __pyx_v_the_cmp; int __pyx_v_offset; long __pyx_v_local_n_cmp; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_r; int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("_lookup_record"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":619 * # the offset array dropped us from 23us to 20us and 156 comparisions * # (1.3/key) * offset = self._offset_for_sha1(sha1) # <<<<<<<<<<<<<< * lo = self.offsets[offset] * hi = self.offsets[offset+1] */ __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self->__pyx_vtab)->_offset_for_sha1(__pyx_v_self, __pyx_v_sha1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_offset = __pyx_t_1; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":620 * # (1.3/key) * offset = self._offset_for_sha1(sha1) * lo = self.offsets[offset] # <<<<<<<<<<<<<< * hi = self.offsets[offset+1] * if hi == 255: */ __pyx_v_lo = (__pyx_v_self->offsets[__pyx_v_offset]); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":621 * offset = self._offset_for_sha1(sha1) * lo = self.offsets[offset] * hi = self.offsets[offset+1] # <<<<<<<<<<<<<< * if hi == 255: * # if hi == 255 that means we potentially ran off the end of the */ __pyx_v_hi = (__pyx_v_self->offsets[(__pyx_v_offset + 1)]); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":622 * lo = self.offsets[offset] * hi = self.offsets[offset+1] * if hi == 255: # <<<<<<<<<<<<<< * # if hi == 255 that means we potentially ran off the end of the * # list, so push it up to num_records */ __pyx_t_2 = (__pyx_v_hi == 255); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":627 * # note that if 'lo' == 255, that is ok, because we can start * # searching from that part of the list. * hi = self.num_records # <<<<<<<<<<<<<< * local_n_cmp = 0 * while lo < hi: */ __pyx_v_hi = __pyx_v_self->num_records; goto __pyx_L3; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":628 * # searching from that part of the list. * hi = self.num_records * local_n_cmp = 0 # <<<<<<<<<<<<<< * while lo < hi: * mid = (lo + hi) / 2 */ __pyx_v_local_n_cmp = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":629 * hi = self.num_records * local_n_cmp = 0 * while lo < hi: # <<<<<<<<<<<<<< * mid = (lo + hi) / 2 * the_cmp = memcmp(self.records[mid].sha1, sha1, 20) */ while (1) { __pyx_t_2 = (__pyx_v_lo < __pyx_v_hi); if (!__pyx_t_2) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":630 * local_n_cmp = 0 * while lo < hi: * mid = (lo + hi) / 2 # <<<<<<<<<<<<<< * the_cmp = memcmp(self.records[mid].sha1, sha1, 20) * if the_cmp == 0: */ __pyx_v_mid = __Pyx_div_long((__pyx_v_lo + __pyx_v_hi), 2); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":631 * while lo < hi: * mid = (lo + hi) / 2 * the_cmp = memcmp(self.records[mid].sha1, sha1, 20) # <<<<<<<<<<<<<< * if the_cmp == 0: * return &self.records[mid] */ __pyx_v_the_cmp = memcmp((__pyx_v_self->records[__pyx_v_mid]).sha1, __pyx_v_sha1, 20); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":632 * mid = (lo + hi) / 2 * the_cmp = memcmp(self.records[mid].sha1, sha1, 20) * if the_cmp == 0: # <<<<<<<<<<<<<< * return &self.records[mid] * elif the_cmp < 0: */ __pyx_t_2 = (__pyx_v_the_cmp == 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":633 * the_cmp = memcmp(self.records[mid].sha1, sha1, 20) * if the_cmp == 0: * return &self.records[mid] # <<<<<<<<<<<<<< * elif the_cmp < 0: * lo = mid + 1 */ __pyx_r = (&(__pyx_v_self->records[__pyx_v_mid])); goto __pyx_L0; goto __pyx_L6; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":634 * if the_cmp == 0: * return &self.records[mid] * elif the_cmp < 0: # <<<<<<<<<<<<<< * lo = mid + 1 * else: */ __pyx_t_2 = (__pyx_v_the_cmp < 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":635 * return &self.records[mid] * elif the_cmp < 0: * lo = mid + 1 # <<<<<<<<<<<<<< * else: * hi = mid */ __pyx_v_lo = (__pyx_v_mid + 1); goto __pyx_L6; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":637 * lo = mid + 1 * else: * hi = mid # <<<<<<<<<<<<<< * return NULL * */ __pyx_v_hi = __pyx_v_mid; } __pyx_L6:; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":638 * else: * hi = mid * return NULL # <<<<<<<<<<<<<< * * def __contains__(self, key): */ __pyx_r = NULL; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._lookup_record"); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":640 * return NULL * * def __contains__(self, key): # <<<<<<<<<<<<<< * cdef char sha1[20] * cdef gc_chk_sha1_record *record */ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static int __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { char __pyx_v_sha1[20]; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_v_record; int __pyx_r; int __pyx_t_1; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("__contains__"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":643 * cdef char sha1[20] * cdef gc_chk_sha1_record *record * if _key_to_sha1(key, sha1): # <<<<<<<<<<<<<< * # If it isn't a sha1 key, then it won't be in this leaf node * record = self._lookup_record(sha1) */ __pyx_t_1 = __pyx_f_6bzrlib_21_btree_serializer_pyx__key_to_sha1(__pyx_v_key, __pyx_v_sha1); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":645 * if _key_to_sha1(key, sha1): * # If it isn't a sha1 key, then it won't be in this leaf node * record = self._lookup_record(sha1) # <<<<<<<<<<<<<< * if record != NULL: * self.last_key = key */ __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->__pyx_vtab)->_lookup_record(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self), __pyx_v_sha1); if (unlikely(__pyx_t_2 == NULL && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_record = __pyx_t_2; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":646 * # If it isn't a sha1 key, then it won't be in this leaf node * record = self._lookup_record(sha1) * if record != NULL: # <<<<<<<<<<<<<< * self.last_key = key * self.last_record = record */ __pyx_t_3 = (__pyx_v_record != NULL); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":647 * record = self._lookup_record(sha1) * if record != NULL: * self.last_key = key # <<<<<<<<<<<<<< * self.last_record = record * return True */ __Pyx_INCREF(__pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); __Pyx_GOTREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); __Pyx_DECREF(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key = __pyx_v_key; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":648 * if record != NULL: * self.last_key = key * self.last_record = record # <<<<<<<<<<<<<< * return True * return False */ ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_record = __pyx_v_record; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":649 * self.last_key = key * self.last_record = record * return True # <<<<<<<<<<<<<< * return False * */ __pyx_r = 1; goto __pyx_L0; goto __pyx_L6; } __pyx_L6:; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":650 * self.last_record = record * return True * return False # <<<<<<<<<<<<<< * * def __getitem__(self, key): */ __pyx_r = 0; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.__contains__"); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":652 * return False * * def __getitem__(self, key): # <<<<<<<<<<<<<< * cdef char sha1[20] * cdef gc_chk_sha1_record *record */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { char __pyx_v_sha1[20]; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_v_record; PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannySetupContext("__getitem__"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":655 * cdef char sha1[20] * cdef gc_chk_sha1_record *record * record = NULL # <<<<<<<<<<<<<< * if self.last_record != NULL and key is self.last_key: * record = self.last_record */ __pyx_v_record = NULL; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":656 * cdef gc_chk_sha1_record *record * record = NULL * if self.last_record != NULL and key is self.last_key: # <<<<<<<<<<<<<< * record = self.last_record * elif _key_to_sha1(key, sha1): */ __pyx_t_1 = (((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_record != NULL); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_key == ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_key); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":657 * record = NULL * if self.last_record != NULL and key is self.last_key: * record = self.last_record # <<<<<<<<<<<<<< * elif _key_to_sha1(key, sha1): * record = self._lookup_record(sha1) */ __pyx_v_record = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->last_record; goto __pyx_L5; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":658 * if self.last_record != NULL and key is self.last_key: * record = self.last_record * elif _key_to_sha1(key, sha1): # <<<<<<<<<<<<<< * record = self._lookup_record(sha1) * if record == NULL: */ __pyx_t_4 = __pyx_f_6bzrlib_21_btree_serializer_pyx__key_to_sha1(__pyx_v_key, __pyx_v_sha1); if (__pyx_t_4) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":659 * record = self.last_record * elif _key_to_sha1(key, sha1): * record = self._lookup_record(sha1) # <<<<<<<<<<<<<< * if record == NULL: * raise KeyError('key %r is not present' % (key,)) */ __pyx_t_5 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->__pyx_vtab)->_lookup_record(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self), __pyx_v_sha1); if (unlikely(__pyx_t_5 == NULL && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_record = __pyx_t_5; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":660 * elif _key_to_sha1(key, sha1): * record = self._lookup_record(sha1) * if record == NULL: # <<<<<<<<<<<<<< * raise KeyError('key %r is not present' % (key,)) * return self._record_to_value_and_refs(record) */ __pyx_t_3 = (__pyx_v_record == NULL); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":661 * record = self._lookup_record(sha1) * if record == NULL: * raise KeyError('key %r is not present' % (key,)) # <<<<<<<<<<<<<< * return self._record_to_value_and_refs(record) * */ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_key); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key); __Pyx_GIVEREF(__pyx_v_key); __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_18), __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_builtin_KeyError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_7, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":662 * if record == NULL: * raise KeyError('key %r is not present' % (key,)) * return self._record_to_value_and_refs(record) # <<<<<<<<<<<<<< * * def __len__(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->__pyx_vtab)->_record_to_value_and_refs(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self), __pyx_v_record)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.__getitem__"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":664 * return self._record_to_value_and_refs(record) * * def __len__(self): # <<<<<<<<<<<<<< * return self.num_records * */ static Py_ssize_t __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannySetupContext("__len__"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":665 * * def __len__(self): * return self.num_records # <<<<<<<<<<<<<< * * def all_keys(self): */ __pyx_r = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":667 * return self.num_records * * def all_keys(self): # <<<<<<<<<<<<<< * cdef int i * result = [] */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_all_keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_all_keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { int __pyx_v_i; PyObject *__pyx_v_result; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("all_keys"); __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":669 * def all_keys(self): * cdef int i * result = [] # <<<<<<<<<<<<<< * for i from 0 <= i < self.num_records: * PyList_Append(result, _sha1_to_key(self.records[i].sha1)) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_v_result)); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":670 * cdef int i * result = [] * for i from 0 <= i < self.num_records: # <<<<<<<<<<<<<< * PyList_Append(result, _sha1_to_key(self.records[i].sha1)) * return result */ __pyx_t_2 = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":671 * result = [] * for i from 0 <= i < self.num_records: * PyList_Append(result, _sha1_to_key(self.records[i].sha1)) # <<<<<<<<<<<<<< * return result * */ __pyx_t_1 = ((PyObject *)__pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_key((((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->records[__pyx_v_i]).sha1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":672 * for i from 0 <= i < self.num_records: * PyList_Append(result, _sha1_to_key(self.records[i].sha1)) * return result # <<<<<<<<<<<<<< * * def all_items(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.all_keys"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":674 * return result * * def all_items(self): # <<<<<<<<<<<<<< * cdef int i * result = [] */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_all_items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_all_items(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { int __pyx_v_i; PyObject *__pyx_v_result; StaticTuple *__pyx_v_item; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("all_items"); __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_item = ((StaticTuple *)Py_None); __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":676 * def all_items(self): * cdef int i * result = [] # <<<<<<<<<<<<<< * for i from 0 <= i < self.num_records: * item = self._record_to_item(&self.records[i]) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_v_result)); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":677 * cdef int i * result = [] * for i from 0 <= i < self.num_records: # <<<<<<<<<<<<<< * item = self._record_to_item(&self.records[i]) * PyList_Append(result, item) */ __pyx_t_2 = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->num_records; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":678 * result = [] * for i from 0 <= i < self.num_records: * item = self._record_to_item(&self.records[i]) # <<<<<<<<<<<<<< * PyList_Append(result, item) * return result */ __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->__pyx_vtab)->_record_to_item(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self), (&(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->records[__pyx_v_i])))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_item)); __pyx_v_item = ((StaticTuple *)__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":679 * for i from 0 <= i < self.num_records: * item = self._record_to_item(&self.records[i]) * PyList_Append(result, item) # <<<<<<<<<<<<<< * return result * */ __pyx_t_3 = PyList_Append(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_v_item)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":680 * item = self._record_to_item(&self.records[i]) * PyList_Append(result, item) * return result # <<<<<<<<<<<<<< * * cdef int _count_records(self, char *c_content, char *c_end): # cannot_raise */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode.all_items"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_result); __Pyx_DECREF((PyObject *)__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":682 * return result * * cdef int _count_records(self, char *c_content, char *c_end): # cannot_raise # <<<<<<<<<<<<<< * """Count how many records are in this section.""" * cdef char *c_cur */ static int __pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__count_records(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self, char *__pyx_v_c_content, char *__pyx_v_c_end) { char *__pyx_v_c_cur; int __pyx_v_num_records; int __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("_count_records"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":687 * cdef int num_records * * c_cur = c_content # <<<<<<<<<<<<<< * num_records = 0 * while c_cur != NULL and c_cur < c_end: */ __pyx_v_c_cur = __pyx_v_c_content; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":688 * * c_cur = c_content * num_records = 0 # <<<<<<<<<<<<<< * while c_cur != NULL and c_cur < c_end: * c_cur = memchr(c_cur, c'\n', c_end - c_cur); */ __pyx_v_num_records = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":689 * c_cur = c_content * num_records = 0 * while c_cur != NULL and c_cur < c_end: # <<<<<<<<<<<<<< * c_cur = memchr(c_cur, c'\n', c_end - c_cur); * if c_cur == NULL: */ while (1) { __pyx_t_1 = (__pyx_v_c_cur != NULL); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_c_cur < __pyx_v_c_end); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (!__pyx_t_3) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":690 * num_records = 0 * while c_cur != NULL and c_cur < c_end: * c_cur = memchr(c_cur, c'\n', c_end - c_cur); # <<<<<<<<<<<<<< * if c_cur == NULL: * break */ __pyx_v_c_cur = ((char *)memchr(__pyx_v_c_cur, '\n', (__pyx_v_c_end - __pyx_v_c_cur))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":691 * while c_cur != NULL and c_cur < c_end: * c_cur = memchr(c_cur, c'\n', c_end - c_cur); * if c_cur == NULL: # <<<<<<<<<<<<<< * break * c_cur = c_cur + 1 */ __pyx_t_3 = (__pyx_v_c_cur == NULL); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":692 * c_cur = memchr(c_cur, c'\n', c_end - c_cur); * if c_cur == NULL: * break # <<<<<<<<<<<<<< * c_cur = c_cur + 1 * num_records = num_records + 1 */ goto __pyx_L4_break; goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":693 * if c_cur == NULL: * break * c_cur = c_cur + 1 # <<<<<<<<<<<<<< * num_records = num_records + 1 * return num_records */ __pyx_v_c_cur = (__pyx_v_c_cur + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":694 * break * c_cur = c_cur + 1 * num_records = num_records + 1 # <<<<<<<<<<<<<< * return num_records * */ __pyx_v_num_records = (__pyx_v_num_records + 1); } __pyx_L4_break:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":695 * c_cur = c_cur + 1 * num_records = num_records + 1 * return num_records # <<<<<<<<<<<<<< * * cdef _parse_bytes(self, bytes): */ __pyx_r = __pyx_v_num_records; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":697 * return num_records * * cdef _parse_bytes(self, bytes): # <<<<<<<<<<<<<< * """Parse the string 'bytes' into content.""" * cdef char *c_bytes */ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__parse_bytes(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self, PyObject *__pyx_v_bytes) { char *__pyx_v_c_bytes; char *__pyx_v_c_cur; char *__pyx_v_c_end; Py_ssize_t __pyx_v_n_bytes; int __pyx_v_num_records; int __pyx_v_entry; __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_v_cur_record; PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; char *__pyx_t_8; __Pyx_RefNannySetupContext("_parse_bytes"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":707 * cdef gc_chk_sha1_record *cur_record * * if not PyString_CheckExact(bytes): # <<<<<<<<<<<<<< * raise TypeError('We only support parsing plain 8-bit strings.') * # Pass 1, count how many records there will be */ __pyx_t_1 = (!PyString_CheckExact(__pyx_v_bytes)); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":708 * * if not PyString_CheckExact(bytes): * raise TypeError('We only support parsing plain 8-bit strings.') # <<<<<<<<<<<<<< * # Pass 1, count how many records there will be * n_bytes = PyString_GET_SIZE(bytes) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_19)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":710 * raise TypeError('We only support parsing plain 8-bit strings.') * # Pass 1, count how many records there will be * n_bytes = PyString_GET_SIZE(bytes) # <<<<<<<<<<<<<< * c_bytes = PyString_AS_STRING(bytes) * c_end = c_bytes + n_bytes */ __pyx_v_n_bytes = PyString_GET_SIZE(__pyx_v_bytes); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":711 * # Pass 1, count how many records there will be * n_bytes = PyString_GET_SIZE(bytes) * c_bytes = PyString_AS_STRING(bytes) # <<<<<<<<<<<<<< * c_end = c_bytes + n_bytes * if strncmp(c_bytes, 'type=leaf\n', 10): */ __pyx_v_c_bytes = PyString_AS_STRING(__pyx_v_bytes); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":712 * n_bytes = PyString_GET_SIZE(bytes) * c_bytes = PyString_AS_STRING(bytes) * c_end = c_bytes + n_bytes # <<<<<<<<<<<<<< * if strncmp(c_bytes, 'type=leaf\n', 10): * raise ValueError("bytes did not start with 'type=leaf\\n': %r" */ __pyx_v_c_end = (__pyx_v_c_bytes + __pyx_v_n_bytes); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":713 * c_bytes = PyString_AS_STRING(bytes) * c_end = c_bytes + n_bytes * if strncmp(c_bytes, 'type=leaf\n', 10): # <<<<<<<<<<<<<< * raise ValueError("bytes did not start with 'type=leaf\\n': %r" * % (bytes[:10],)) */ __pyx_t_4 = strncmp(__pyx_v_c_bytes, __pyx_k_20, 10); if (__pyx_t_4) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":715 * if strncmp(c_bytes, 'type=leaf\n', 10): * raise ValueError("bytes did not start with 'type=leaf\\n': %r" * % (bytes[:10],)) # <<<<<<<<<<<<<< * c_cur = c_bytes + 10 * num_records = self._count_records(c_cur, c_end) */ __pyx_t_3 = PySequence_GetSlice(__pyx_v_bytes, 0, 10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":716 * raise ValueError("bytes did not start with 'type=leaf\\n': %r" * % (bytes[:10],)) * c_cur = c_bytes + 10 # <<<<<<<<<<<<<< * num_records = self._count_records(c_cur, c_end) * # Now allocate the memory for these items, and go to town */ __pyx_v_c_cur = (__pyx_v_c_bytes + 10); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":717 * % (bytes[:10],)) * c_cur = c_bytes + 10 * num_records = self._count_records(c_cur, c_end) # <<<<<<<<<<<<<< * # Now allocate the memory for these items, and go to town * self.records = PyMem_Malloc(num_records * */ __pyx_v_num_records = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self->__pyx_vtab)->_count_records(__pyx_v_self, __pyx_v_c_cur, __pyx_v_c_end); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":719 * num_records = self._count_records(c_cur, c_end) * # Now allocate the memory for these items, and go to town * self.records = PyMem_Malloc(num_records * # <<<<<<<<<<<<<< * (sizeof(unsigned short) + sizeof(gc_chk_sha1_record))) * self.num_records = num_records */ __pyx_v_self->records = ((__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *)PyMem_Malloc((__pyx_v_num_records * ((sizeof(unsigned short)) + (sizeof(__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record)))))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":721 * self.records = PyMem_Malloc(num_records * * (sizeof(unsigned short) + sizeof(gc_chk_sha1_record))) * self.num_records = num_records # <<<<<<<<<<<<<< * cur_record = self.records * entry = 0 */ __pyx_v_self->num_records = __pyx_v_num_records; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":722 * (sizeof(unsigned short) + sizeof(gc_chk_sha1_record))) * self.num_records = num_records * cur_record = self.records # <<<<<<<<<<<<<< * entry = 0 * while c_cur != NULL and c_cur < c_end and entry < num_records: */ __pyx_v_cur_record = __pyx_v_self->records; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":723 * self.num_records = num_records * cur_record = self.records * entry = 0 # <<<<<<<<<<<<<< * while c_cur != NULL and c_cur < c_end and entry < num_records: * c_cur = self._parse_one_entry(c_cur, c_end, cur_record) */ __pyx_v_entry = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":724 * cur_record = self.records * entry = 0 * while c_cur != NULL and c_cur < c_end and entry < num_records: # <<<<<<<<<<<<<< * c_cur = self._parse_one_entry(c_cur, c_end, cur_record) * cur_record = cur_record + 1 */ while (1) { __pyx_t_1 = (__pyx_v_c_cur != NULL); if (__pyx_t_1) { __pyx_t_5 = (__pyx_v_c_cur < __pyx_v_c_end); if (__pyx_t_5) { __pyx_t_6 = (__pyx_v_entry < __pyx_v_num_records); __pyx_t_7 = __pyx_t_6; } else { __pyx_t_7 = __pyx_t_5; } __pyx_t_5 = __pyx_t_7; } else { __pyx_t_5 = __pyx_t_1; } if (!__pyx_t_5) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":725 * entry = 0 * while c_cur != NULL and c_cur < c_end and entry < num_records: * c_cur = self._parse_one_entry(c_cur, c_end, cur_record) # <<<<<<<<<<<<<< * cur_record = cur_record + 1 * entry = entry + 1 */ __pyx_t_8 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self->__pyx_vtab)->_parse_one_entry(__pyx_v_self, __pyx_v_c_cur, __pyx_v_c_end, __pyx_v_cur_record); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_c_cur = __pyx_t_8; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":726 * while c_cur != NULL and c_cur < c_end and entry < num_records: * c_cur = self._parse_one_entry(c_cur, c_end, cur_record) * cur_record = cur_record + 1 # <<<<<<<<<<<<<< * entry = entry + 1 * if (entry != self.num_records */ __pyx_v_cur_record = (__pyx_v_cur_record + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":727 * c_cur = self._parse_one_entry(c_cur, c_end, cur_record) * cur_record = cur_record + 1 * entry = entry + 1 # <<<<<<<<<<<<<< * if (entry != self.num_records * or c_cur != c_end */ __pyx_v_entry = (__pyx_v_entry + 1); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":728 * cur_record = cur_record + 1 * entry = entry + 1 * if (entry != self.num_records # <<<<<<<<<<<<<< * or c_cur != c_end * or cur_record != self.records + self.num_records): */ __pyx_t_5 = (__pyx_v_entry != __pyx_v_self->num_records); if (!__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":730 * if (entry != self.num_records * or c_cur != c_end * or cur_record != self.records + self.num_records): # <<<<<<<<<<<<<< * raise ValueError('Something went wrong while parsing.') * # Pass 3: build the offset map */ __pyx_t_1 = (__pyx_v_c_cur != __pyx_v_c_end); if (!__pyx_t_1) { __pyx_t_7 = (__pyx_v_cur_record != (__pyx_v_self->records + __pyx_v_self->num_records)); __pyx_t_6 = __pyx_t_7; } else { __pyx_t_6 = __pyx_t_1; } __pyx_t_1 = __pyx_t_6; } else { __pyx_t_1 = __pyx_t_5; } if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":731 * or c_cur != c_end * or cur_record != self.records + self.num_records): * raise ValueError('Something went wrong while parsing.') # <<<<<<<<<<<<<< * # Pass 3: build the offset map * self._compute_common() */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_22)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":733 * raise ValueError('Something went wrong while parsing.') * # Pass 3: build the offset map * self._compute_common() # <<<<<<<<<<<<<< * * cdef char *_parse_one_entry(self, char *c_cur, char *c_end, */ __pyx_t_2 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self->__pyx_vtab)->_compute_common(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._parse_bytes"); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":735 * self._compute_common() * * cdef char *_parse_one_entry(self, char *c_cur, char *c_end, # <<<<<<<<<<<<<< * gc_chk_sha1_record *cur_record) except NULL: * """Read a single sha record from the bytes. */ static char *__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__parse_one_entry(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self, char *__pyx_v_c_cur, char *__pyx_v_c_end, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *__pyx_v_cur_record) { char *__pyx_v_c_next; char *__pyx_r; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; __Pyx_RefNannySetupContext("_parse_one_entry"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":742 * """ * cdef char *c_next * if strncmp(c_cur, 'sha1:', 5): # <<<<<<<<<<<<<< * raise ValueError('line did not start with sha1: %r' * % (safe_string_from_size(c_cur, 10),)) */ __pyx_t_1 = strncmp(__pyx_v_c_cur, __pyx_k_3, 5); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":744 * if strncmp(c_cur, 'sha1:', 5): * raise ValueError('line did not start with sha1: %r' * % (safe_string_from_size(c_cur, 10),)) # <<<<<<<<<<<<<< * c_cur = c_cur + 5 * c_next = memchr(c_cur, c'\0', c_end - c_cur) */ __pyx_t_2 = __pyx_f_6bzrlib_21_btree_serializer_pyx_safe_string_from_size(__pyx_v_c_cur, 10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":745 * raise ValueError('line did not start with sha1: %r' * % (safe_string_from_size(c_cur, 10),)) * c_cur = c_cur + 5 # <<<<<<<<<<<<<< * c_next = memchr(c_cur, c'\0', c_end - c_cur) * if c_next == NULL or (c_next - c_cur != 40): */ __pyx_v_c_cur = (__pyx_v_c_cur + 5); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":746 * % (safe_string_from_size(c_cur, 10),)) * c_cur = c_cur + 5 * c_next = memchr(c_cur, c'\0', c_end - c_cur) # <<<<<<<<<<<<<< * if c_next == NULL or (c_next - c_cur != 40): * raise ValueError('Line did not contain 40 hex bytes') */ __pyx_v_c_next = ((char *)memchr(__pyx_v_c_cur, '\x00', (__pyx_v_c_end - __pyx_v_c_cur))); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":747 * c_cur = c_cur + 5 * c_next = memchr(c_cur, c'\0', c_end - c_cur) * if c_next == NULL or (c_next - c_cur != 40): # <<<<<<<<<<<<<< * raise ValueError('Line did not contain 40 hex bytes') * if not _unhexlify_sha1(c_cur, cur_record.sha1): */ __pyx_t_4 = (__pyx_v_c_next == NULL); if (!__pyx_t_4) { __pyx_t_5 = ((__pyx_v_c_next - __pyx_v_c_cur) != 40); __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_4; } if (__pyx_t_6) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":748 * c_next = memchr(c_cur, c'\0', c_end - c_cur) * if c_next == NULL or (c_next - c_cur != 40): * raise ValueError('Line did not contain 40 hex bytes') # <<<<<<<<<<<<<< * if not _unhexlify_sha1(c_cur, cur_record.sha1): * raise ValueError('We failed to unhexlify') */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_24)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24)); __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":749 * if c_next == NULL or (c_next - c_cur != 40): * raise ValueError('Line did not contain 40 hex bytes') * if not _unhexlify_sha1(c_cur, cur_record.sha1): # <<<<<<<<<<<<<< * raise ValueError('We failed to unhexlify') * c_cur = c_next + 1 */ __pyx_t_6 = (!__pyx_f_6bzrlib_21_btree_serializer_pyx__unhexlify_sha1(__pyx_v_c_cur, __pyx_v_cur_record->sha1)); if (__pyx_t_6) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":750 * raise ValueError('Line did not contain 40 hex bytes') * if not _unhexlify_sha1(c_cur, cur_record.sha1): * raise ValueError('We failed to unhexlify') # <<<<<<<<<<<<<< * c_cur = c_next + 1 * if c_cur[0] != c'\0': */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_25)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_25)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25)); __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":751 * if not _unhexlify_sha1(c_cur, cur_record.sha1): * raise ValueError('We failed to unhexlify') * c_cur = c_next + 1 # <<<<<<<<<<<<<< * if c_cur[0] != c'\0': * raise ValueError('only 1 null, not 2 as expected') */ __pyx_v_c_cur = (__pyx_v_c_next + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":752 * raise ValueError('We failed to unhexlify') * c_cur = c_next + 1 * if c_cur[0] != c'\0': # <<<<<<<<<<<<<< * raise ValueError('only 1 null, not 2 as expected') * c_cur = c_cur + 1 */ __pyx_t_6 = ((__pyx_v_c_cur[0]) != '\x00'); if (__pyx_t_6) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":753 * c_cur = c_next + 1 * if c_cur[0] != c'\0': * raise ValueError('only 1 null, not 2 as expected') # <<<<<<<<<<<<<< * c_cur = c_cur + 1 * cur_record.block_offset = strtoll(c_cur, &c_next, 10) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_26)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_26)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26)); __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":754 * if c_cur[0] != c'\0': * raise ValueError('only 1 null, not 2 as expected') * c_cur = c_cur + 1 # <<<<<<<<<<<<<< * cur_record.block_offset = strtoll(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': */ __pyx_v_c_cur = (__pyx_v_c_cur + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":755 * raise ValueError('only 1 null, not 2 as expected') * c_cur = c_cur + 1 * cur_record.block_offset = strtoll(c_cur, &c_next, 10) # <<<<<<<<<<<<<< * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block offset') */ __pyx_v_cur_record->block_offset = strtoll(__pyx_v_c_cur, (&__pyx_v_c_next), 10); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":756 * c_cur = c_cur + 1 * cur_record.block_offset = strtoll(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': # <<<<<<<<<<<<<< * raise ValueError('Failed to parse block offset') * c_cur = c_next + 1 */ __pyx_t_6 = (__pyx_v_c_cur == __pyx_v_c_next); if (!__pyx_t_6) { __pyx_t_4 = ((__pyx_v_c_next[0]) != ' '); __pyx_t_5 = __pyx_t_4; } else { __pyx_t_5 = __pyx_t_6; } if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":757 * cur_record.block_offset = strtoll(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block offset') # <<<<<<<<<<<<<< * c_cur = c_next + 1 * cur_record.block_length = strtoul(c_cur, &c_next, 10) */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_27)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_27)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27)); __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":758 * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block offset') * c_cur = c_next + 1 # <<<<<<<<<<<<<< * cur_record.block_length = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': */ __pyx_v_c_cur = (__pyx_v_c_next + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":759 * raise ValueError('Failed to parse block offset') * c_cur = c_next + 1 * cur_record.block_length = strtoul(c_cur, &c_next, 10) # <<<<<<<<<<<<<< * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block length') */ __pyx_v_cur_record->block_length = strtoul(__pyx_v_c_cur, (&__pyx_v_c_next), 10); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":760 * c_cur = c_next + 1 * cur_record.block_length = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': # <<<<<<<<<<<<<< * raise ValueError('Failed to parse block length') * c_cur = c_next + 1 */ __pyx_t_5 = (__pyx_v_c_cur == __pyx_v_c_next); if (!__pyx_t_5) { __pyx_t_6 = ((__pyx_v_c_next[0]) != ' '); __pyx_t_4 = __pyx_t_6; } else { __pyx_t_4 = __pyx_t_5; } if (__pyx_t_4) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":761 * cur_record.block_length = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block length') # <<<<<<<<<<<<<< * c_cur = c_next + 1 * cur_record.record_start = strtoul(c_cur, &c_next, 10) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_28)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_28)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28)); __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":762 * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block length') * c_cur = c_next + 1 # <<<<<<<<<<<<<< * cur_record.record_start = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': */ __pyx_v_c_cur = (__pyx_v_c_next + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":763 * raise ValueError('Failed to parse block length') * c_cur = c_next + 1 * cur_record.record_start = strtoul(c_cur, &c_next, 10) # <<<<<<<<<<<<<< * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block length') */ __pyx_v_cur_record->record_start = strtoul(__pyx_v_c_cur, (&__pyx_v_c_next), 10); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":764 * c_cur = c_next + 1 * cur_record.record_start = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': # <<<<<<<<<<<<<< * raise ValueError('Failed to parse block length') * c_cur = c_next + 1 */ __pyx_t_4 = (__pyx_v_c_cur == __pyx_v_c_next); if (!__pyx_t_4) { __pyx_t_5 = ((__pyx_v_c_next[0]) != ' '); __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_4; } if (__pyx_t_6) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":765 * cur_record.record_start = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block length') # <<<<<<<<<<<<<< * c_cur = c_next + 1 * cur_record.record_end = strtoul(c_cur, &c_next, 10) */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_28)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_28)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28)); __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L9; } __pyx_L9:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":766 * if c_cur == c_next or c_next[0] != c' ': * raise ValueError('Failed to parse block length') * c_cur = c_next + 1 # <<<<<<<<<<<<<< * cur_record.record_end = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c'\n': */ __pyx_v_c_cur = (__pyx_v_c_next + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":767 * raise ValueError('Failed to parse block length') * c_cur = c_next + 1 * cur_record.record_end = strtoul(c_cur, &c_next, 10) # <<<<<<<<<<<<<< * if c_cur == c_next or c_next[0] != c'\n': * raise ValueError('Failed to parse record end') */ __pyx_v_cur_record->record_end = strtoul(__pyx_v_c_cur, (&__pyx_v_c_next), 10); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":768 * c_cur = c_next + 1 * cur_record.record_end = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c'\n': # <<<<<<<<<<<<<< * raise ValueError('Failed to parse record end') * c_cur = c_next + 1 */ __pyx_t_6 = (__pyx_v_c_cur == __pyx_v_c_next); if (!__pyx_t_6) { __pyx_t_4 = ((__pyx_v_c_next[0]) != '\n'); __pyx_t_5 = __pyx_t_4; } else { __pyx_t_5 = __pyx_t_6; } if (__pyx_t_5) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":769 * cur_record.record_end = strtoul(c_cur, &c_next, 10) * if c_cur == c_next or c_next[0] != c'\n': * raise ValueError('Failed to parse record end') # <<<<<<<<<<<<<< * c_cur = c_next + 1 * return c_cur */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_29)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":770 * if c_cur == c_next or c_next[0] != c'\n': * raise ValueError('Failed to parse record end') * c_cur = c_next + 1 # <<<<<<<<<<<<<< * return c_cur * */ __pyx_v_c_cur = (__pyx_v_c_next + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":771 * raise ValueError('Failed to parse record end') * c_cur = c_next + 1 * return c_cur # <<<<<<<<<<<<<< * * cdef int _offset_for_sha1(self, char *sha1) except -1: */ __pyx_r = __pyx_v_c_cur; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._parse_one_entry"); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":773 * return c_cur * * cdef int _offset_for_sha1(self, char *sha1) except -1: # <<<<<<<<<<<<<< * """Find the first interesting 8-bits of this sha1.""" * cdef int this_offset */ static int __pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__offset_for_sha1(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self, char *__pyx_v_sha1) { int __pyx_v_this_offset; unsigned int __pyx_v_as_uint; int __pyx_r; __Pyx_RefNannySetupContext("_offset_for_sha1"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":777 * cdef int this_offset * cdef unsigned int as_uint * as_uint = _sha1_to_uint(sha1) # <<<<<<<<<<<<<< * this_offset = (as_uint >> self.common_shift) & 0xFF * return this_offset */ __pyx_v_as_uint = __pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_uint(__pyx_v_sha1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":778 * cdef unsigned int as_uint * as_uint = _sha1_to_uint(sha1) * this_offset = (as_uint >> self.common_shift) & 0xFF # <<<<<<<<<<<<<< * return this_offset * */ __pyx_v_this_offset = ((__pyx_v_as_uint >> __pyx_v_self->common_shift) & 0xFF); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":779 * as_uint = _sha1_to_uint(sha1) * this_offset = (as_uint >> self.common_shift) & 0xFF * return this_offset # <<<<<<<<<<<<<< * * def _get_offset_for_sha1(self, sha1): */ __pyx_r = __pyx_v_this_offset; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":781 * return this_offset * * def _get_offset_for_sha1(self, sha1): # <<<<<<<<<<<<<< * return self._offset_for_sha1(PyString_AS_STRING(sha1)) * */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__get_offset_for_sha1(PyObject *__pyx_v_self, PyObject *__pyx_v_sha1); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__get_offset_for_sha1(PyObject *__pyx_v_self, PyObject *__pyx_v_sha1) { PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("_get_offset_for_sha1"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":782 * * def _get_offset_for_sha1(self, sha1): * return self._offset_for_sha1(PyString_AS_STRING(sha1)) # <<<<<<<<<<<<<< * * cdef _compute_common(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->__pyx_vtab)->_offset_for_sha1(((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self), PyString_AS_STRING(__pyx_v_sha1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._get_offset_for_sha1"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":784 * return self._offset_for_sha1(PyString_AS_STRING(sha1)) * * cdef _compute_common(self): # <<<<<<<<<<<<<< * cdef unsigned int first * cdef unsigned int this */ static PyObject *__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__compute_common(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *__pyx_v_self) { unsigned int __pyx_v_first; unsigned int __pyx_v_this; unsigned int __pyx_v_common_mask; unsigned char __pyx_v_common_shift; int __pyx_v_i; int __pyx_v_offset; int __pyx_v_this_offset; int __pyx_v_max_offset; PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; __Pyx_RefNannySetupContext("_compute_common"); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":798 * # By XORing the records together, we can determine what bits are set in * # all of them * if self.num_records < 2: # <<<<<<<<<<<<<< * # Everything is in common if you have 0 or 1 leaves * # So we'll always just shift to the first byte */ __pyx_t_1 = (__pyx_v_self->num_records < 2); if (__pyx_t_1) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":801 * # Everything is in common if you have 0 or 1 leaves * # So we'll always just shift to the first byte * self.common_shift = 24 # <<<<<<<<<<<<<< * else: * common_mask = 0xFFFFFFFF */ __pyx_v_self->common_shift = 24; goto __pyx_L3; } /*else*/ { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":803 * self.common_shift = 24 * else: * common_mask = 0xFFFFFFFF # <<<<<<<<<<<<<< * first = _sha1_to_uint(self.records[0].sha1) * for i from 0 < i < self.num_records: */ __pyx_v_common_mask = 0xFFFFFFFF; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":804 * else: * common_mask = 0xFFFFFFFF * first = _sha1_to_uint(self.records[0].sha1) # <<<<<<<<<<<<<< * for i from 0 < i < self.num_records: * this = _sha1_to_uint(self.records[i].sha1) */ __pyx_v_first = __pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_uint((__pyx_v_self->records[0]).sha1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":805 * common_mask = 0xFFFFFFFF * first = _sha1_to_uint(self.records[0].sha1) * for i from 0 < i < self.num_records: # <<<<<<<<<<<<<< * this = _sha1_to_uint(self.records[i].sha1) * common_mask = (~(first ^ this)) & common_mask */ __pyx_t_2 = __pyx_v_self->num_records; for (__pyx_v_i = 0+1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":806 * first = _sha1_to_uint(self.records[0].sha1) * for i from 0 < i < self.num_records: * this = _sha1_to_uint(self.records[i].sha1) # <<<<<<<<<<<<<< * common_mask = (~(first ^ this)) & common_mask * common_shift = 24 */ __pyx_v_this = __pyx_f_6bzrlib_21_btree_serializer_pyx__sha1_to_uint((__pyx_v_self->records[__pyx_v_i]).sha1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":807 * for i from 0 < i < self.num_records: * this = _sha1_to_uint(self.records[i].sha1) * common_mask = (~(first ^ this)) & common_mask # <<<<<<<<<<<<<< * common_shift = 24 * while common_mask & 0x80000000 and common_shift > 0: */ __pyx_v_common_mask = ((~(__pyx_v_first ^ __pyx_v_this)) & __pyx_v_common_mask); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":808 * this = _sha1_to_uint(self.records[i].sha1) * common_mask = (~(first ^ this)) & common_mask * common_shift = 24 # <<<<<<<<<<<<<< * while common_mask & 0x80000000 and common_shift > 0: * common_mask = common_mask << 1 */ __pyx_v_common_shift = 24; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":809 * common_mask = (~(first ^ this)) & common_mask * common_shift = 24 * while common_mask & 0x80000000 and common_shift > 0: # <<<<<<<<<<<<<< * common_mask = common_mask << 1 * common_shift = common_shift - 1 */ while (1) { if ((__pyx_v_common_mask & 0x80000000)) { __pyx_t_1 = (__pyx_v_common_shift > 0); __pyx_t_3 = __pyx_t_1; } else { __pyx_t_3 = (__pyx_v_common_mask & 0x80000000); } if (!__pyx_t_3) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":810 * common_shift = 24 * while common_mask & 0x80000000 and common_shift > 0: * common_mask = common_mask << 1 # <<<<<<<<<<<<<< * common_shift = common_shift - 1 * self.common_shift = common_shift */ __pyx_v_common_mask = (__pyx_v_common_mask << 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":811 * while common_mask & 0x80000000 and common_shift > 0: * common_mask = common_mask << 1 * common_shift = common_shift - 1 # <<<<<<<<<<<<<< * self.common_shift = common_shift * offset = 0 */ __pyx_v_common_shift = (__pyx_v_common_shift - 1); } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":812 * common_mask = common_mask << 1 * common_shift = common_shift - 1 * self.common_shift = common_shift # <<<<<<<<<<<<<< * offset = 0 * max_offset = self.num_records */ __pyx_v_self->common_shift = __pyx_v_common_shift; } __pyx_L3:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":813 * common_shift = common_shift - 1 * self.common_shift = common_shift * offset = 0 # <<<<<<<<<<<<<< * max_offset = self.num_records * # We cap this loop at 254 records. All the other offsets just get */ __pyx_v_offset = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":814 * self.common_shift = common_shift * offset = 0 * max_offset = self.num_records # <<<<<<<<<<<<<< * # We cap this loop at 254 records. All the other offsets just get * # filled with 0xff as the singleton saying 'too many'. */ __pyx_v_max_offset = __pyx_v_self->num_records; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":819 * # It means that if we have >255 records we have to bisect the second * # half of the list, but this is going to be very rare in practice. * if max_offset > 255: # <<<<<<<<<<<<<< * max_offset = 255 * for i from 0 <= i < max_offset: */ __pyx_t_3 = (__pyx_v_max_offset > 255); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":820 * # half of the list, but this is going to be very rare in practice. * if max_offset > 255: * max_offset = 255 # <<<<<<<<<<<<<< * for i from 0 <= i < max_offset: * this_offset = self._offset_for_sha1(self.records[i].sha1) */ __pyx_v_max_offset = 255; goto __pyx_L8; } __pyx_L8:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":821 * if max_offset > 255: * max_offset = 255 * for i from 0 <= i < max_offset: # <<<<<<<<<<<<<< * this_offset = self._offset_for_sha1(self.records[i].sha1) * while offset <= this_offset: */ __pyx_t_2 = __pyx_v_max_offset; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":822 * max_offset = 255 * for i from 0 <= i < max_offset: * this_offset = self._offset_for_sha1(self.records[i].sha1) # <<<<<<<<<<<<<< * while offset <= this_offset: * self.offsets[offset] = i */ __pyx_t_4 = ((struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self->__pyx_vtab)->_offset_for_sha1(__pyx_v_self, (__pyx_v_self->records[__pyx_v_i]).sha1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_this_offset = __pyx_t_4; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":823 * for i from 0 <= i < max_offset: * this_offset = self._offset_for_sha1(self.records[i].sha1) * while offset <= this_offset: # <<<<<<<<<<<<<< * self.offsets[offset] = i * offset = offset + 1 */ while (1) { __pyx_t_3 = (__pyx_v_offset <= __pyx_v_this_offset); if (!__pyx_t_3) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":824 * this_offset = self._offset_for_sha1(self.records[i].sha1) * while offset <= this_offset: * self.offsets[offset] = i # <<<<<<<<<<<<<< * offset = offset + 1 * while offset < 257: */ (__pyx_v_self->offsets[__pyx_v_offset]) = __pyx_v_i; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":825 * while offset <= this_offset: * self.offsets[offset] = i * offset = offset + 1 # <<<<<<<<<<<<<< * while offset < 257: * self.offsets[offset] = max_offset */ __pyx_v_offset = (__pyx_v_offset + 1); } } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":826 * self.offsets[offset] = i * offset = offset + 1 * while offset < 257: # <<<<<<<<<<<<<< * self.offsets[offset] = max_offset * offset = offset + 1 */ while (1) { __pyx_t_3 = (__pyx_v_offset < 257); if (!__pyx_t_3) break; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":827 * offset = offset + 1 * while offset < 257: * self.offsets[offset] = max_offset # <<<<<<<<<<<<<< * offset = offset + 1 * */ (__pyx_v_self->offsets[__pyx_v_offset]) = __pyx_v_max_offset; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":828 * while offset < 257: * self.offsets[offset] = max_offset * offset = offset + 1 # <<<<<<<<<<<<<< * * def _get_offsets(self): */ __pyx_v_offset = (__pyx_v_offset + 1); } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._compute_common"); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":830 * offset = offset + 1 * * def _get_offsets(self): # <<<<<<<<<<<<<< * cdef int i * result = [] */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__get_offsets(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__get_offsets(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { int __pyx_v_i; PyObject *__pyx_v_result; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; __Pyx_RefNannySetupContext("_get_offsets"); __pyx_v_result = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":832 * def _get_offsets(self): * cdef int i * result = [] # <<<<<<<<<<<<<< * for i from 0 <= i < 257: * PyList_Append(result, self.offsets[i]) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_v_result)); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":833 * cdef int i * result = [] * for i from 0 <= i < 257: # <<<<<<<<<<<<<< * PyList_Append(result, self.offsets[i]) * return result */ for (__pyx_v_i = 0; __pyx_v_i < 257; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":834 * result = [] * for i from 0 <= i < 257: * PyList_Append(result, self.offsets[i]) # <<<<<<<<<<<<<< * return result * */ __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)__pyx_v_self)->offsets[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyList_Append(((PyObject *)__pyx_v_result), __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":835 * for i from 0 <= i < 257: * PyList_Append(result, self.offsets[i]) * return result # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode._get_offsets"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":838 * * * def _parse_into_chk(bytes, key_length, ref_list_length): # <<<<<<<<<<<<<< * """Parse into a format optimized for chk records.""" * assert key_length == 1 */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__parse_into_chk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6bzrlib_21_btree_serializer_pyx__parse_into_chk[] = "Parse into a format optimized for chk records."; static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__parse_into_chk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_bytes = 0; PyObject *__pyx_v_key_length = 0; PyObject *__pyx_v_ref_list_length = 0; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bytes,&__pyx_n_s__key_length,&__pyx_n_s__ref_list_length,0}; __Pyx_RefNannySetupContext("_parse_into_chk"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bytes); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key_length); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_parse_into_chk", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref_list_length); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_parse_into_chk", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parse_into_chk") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_bytes = values[0]; __pyx_v_key_length = values[1]; __pyx_v_ref_list_length = values[2]; } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { __pyx_v_bytes = PyTuple_GET_ITEM(__pyx_args, 0); __pyx_v_key_length = PyTuple_GET_ITEM(__pyx_args, 1); __pyx_v_ref_list_length = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_parse_into_chk", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._parse_into_chk"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":840 * def _parse_into_chk(bytes, key_length, ref_list_length): * """Parse into a format optimized for chk records.""" * assert key_length == 1 # <<<<<<<<<<<<<< * assert ref_list_length == 0 * return GCCHKSHA1LeafNode(bytes) */ #ifndef PYREX_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_RichCompare(__pyx_v_key_length, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":841 * """Parse into a format optimized for chk records.""" * assert key_length == 1 * assert ref_list_length == 0 # <<<<<<<<<<<<<< * return GCCHKSHA1LeafNode(bytes) * */ #ifndef PYREX_WITHOUT_ASSERTIONS __pyx_t_1 = PyObject_RichCompare(__pyx_v_ref_list_length, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":842 * assert key_length == 1 * assert ref_list_length == 0 * return GCCHKSHA1LeafNode(bytes) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_bytes); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bytes); __Pyx_GIVEREF(__pyx_v_bytes); __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._parse_into_chk"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":845 * * * def _flatten_node(node, reference_lists): # <<<<<<<<<<<<<< * """Convert a node into the serialized form. * */ static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__flatten_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6bzrlib_21_btree_serializer_pyx__flatten_node[] = "Convert a node into the serialized form.\n\n :param node: A tuple representing a node:\n (index, key_tuple, value, references)\n :param reference_lists: Does this index have reference lists?\n :return: (string_key, flattened)\n string_key The serialized key for referencing this node\n flattened A string with the serialized form for the contents\n "; static PyObject *__pyx_pf_6bzrlib_21_btree_serializer_pyx__flatten_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_node = 0; PyObject *__pyx_v_reference_lists = 0; int __pyx_v_have_reference_lists; Py_ssize_t __pyx_v_flat_len; Py_ssize_t __pyx_v_key_len; Py_ssize_t __pyx_v_node_len; char *__pyx_v_value; Py_ssize_t __pyx_v_value_len; char *__pyx_v_out; Py_ssize_t __pyx_v_refs_len; Py_ssize_t __pyx_v_next_len; int __pyx_v_first_ref_list; int __pyx_v_first_reference; int __pyx_v_i; Py_ssize_t __pyx_v_ref_bit_len; PyObject *__pyx_v_string_key; PyObject *__pyx_v_ref_lists; PyObject *__pyx_v_ref_list; PyObject *__pyx_v_reference; PyObject *__pyx_v_ref_bit; PyObject *__pyx_v_val; PyObject *__pyx_v_line; PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; PyObject *__pyx_t_10 = NULL; Py_ssize_t __pyx_t_11; PyObject *__pyx_t_12 = NULL; char *__pyx_t_13; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__node,&__pyx_n_s__reference_lists,0}; __Pyx_RefNannySetupContext("_flatten_node"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__node); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference_lists); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_flatten_node", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_flatten_node") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_node = values[0]; __pyx_v_reference_lists = values[1]; } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { __pyx_v_node = PyTuple_GET_ITEM(__pyx_args, 0); __pyx_v_reference_lists = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_flatten_node", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._flatten_node"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_v_string_key = Py_None; __Pyx_INCREF(Py_None); __pyx_v_ref_lists = Py_None; __Pyx_INCREF(Py_None); __pyx_v_ref_list = Py_None; __Pyx_INCREF(Py_None); __pyx_v_reference = Py_None; __Pyx_INCREF(Py_None); __pyx_v_ref_bit = Py_None; __Pyx_INCREF(Py_None); __pyx_v_val = Py_None; __Pyx_INCREF(Py_None); __pyx_v_line = Py_None; __Pyx_INCREF(Py_None); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":869 * cdef Py_ssize_t ref_bit_len * * if not PyTuple_CheckExact(node) and not StaticTuple_CheckExact(node): # <<<<<<<<<<<<<< * raise TypeError('We expected a tuple() or StaticTuple() for node not: %s' * % type(node)) */ __pyx_t_1 = (!PyTuple_CheckExact(__pyx_v_node)); if (__pyx_t_1) { __pyx_t_2 = (!StaticTuple_CheckExact(__pyx_v_node)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":871 * if not PyTuple_CheckExact(node) and not StaticTuple_CheckExact(node): * raise TypeError('We expected a tuple() or StaticTuple() for node not: %s' * % type(node)) # <<<<<<<<<<<<<< * node_len = len(node) * have_reference_lists = reference_lists */ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), ((PyObject *)Py_TYPE(__pyx_v_node))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":872 * raise TypeError('We expected a tuple() or StaticTuple() for node not: %s' * % type(node)) * node_len = len(node) # <<<<<<<<<<<<<< * have_reference_lists = reference_lists * if have_reference_lists: */ __pyx_t_6 = PyObject_Length(__pyx_v_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_node_len = __pyx_t_6; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":873 * % type(node)) * node_len = len(node) * have_reference_lists = reference_lists # <<<<<<<<<<<<<< * if have_reference_lists: * if node_len != 4: */ __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_reference_lists); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_have_reference_lists = __pyx_t_7; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":874 * node_len = len(node) * have_reference_lists = reference_lists * if have_reference_lists: # <<<<<<<<<<<<<< * if node_len != 4: * raise ValueError('With ref_lists, we expected 4 entries not: %s' */ if (__pyx_v_have_reference_lists) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":875 * have_reference_lists = reference_lists * if have_reference_lists: * if node_len != 4: # <<<<<<<<<<<<<< * raise ValueError('With ref_lists, we expected 4 entries not: %s' * % len(node)) */ __pyx_t_3 = (__pyx_v_node_len != 4); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":877 * if node_len != 4: * raise ValueError('With ref_lists, we expected 4 entries not: %s' * % len(node)) # <<<<<<<<<<<<<< * elif node_len < 3: * raise ValueError('Without ref_lists, we need at least 3 entries not: %s' */ __pyx_t_6 = PyObject_Length(__pyx_v_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; goto __pyx_L7; } /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":878 * raise ValueError('With ref_lists, we expected 4 entries not: %s' * % len(node)) * elif node_len < 3: # <<<<<<<<<<<<<< * raise ValueError('Without ref_lists, we need at least 3 entries not: %s' * % len(node)) */ __pyx_t_3 = (__pyx_v_node_len < 3); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":880 * elif node_len < 3: * raise ValueError('Without ref_lists, we need at least 3 entries not: %s' * % len(node)) # <<<<<<<<<<<<<< * # TODO: We can probably do better than string.join(), namely * # when key has only 1 item, we can just grab that string */ __pyx_t_6 = PyObject_Length(__pyx_v_node); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":891 * # We *could* do more work on our own, and grab the actual items * # lists. For now, just ask people to use a better compiler. :) * string_key = '\0'.join(node[1]) # <<<<<<<<<<<<<< * * # TODO: instead of using string joins, precompute the final string length, */ __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_33), __pyx_n_s__join); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_node, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_string_key); __pyx_v_string_key = __pyx_t_5; __pyx_t_5 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":905 * # ref := BYTES (NULL BYTES)* * # value := BYTES * refs_len = 0 # <<<<<<<<<<<<<< * if have_reference_lists: * # Figure out how many bytes it will take to store the references */ __pyx_v_refs_len = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":906 * # value := BYTES * refs_len = 0 * if have_reference_lists: # <<<<<<<<<<<<<< * # Figure out how many bytes it will take to store the references * ref_lists = node[3] */ if (__pyx_v_have_reference_lists) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":908 * if have_reference_lists: * # Figure out how many bytes it will take to store the references * ref_lists = node[3] # <<<<<<<<<<<<<< * next_len = len(ref_lists) # TODO: use a Py function * if next_len > 0: */ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_node, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_v_ref_lists); __pyx_v_ref_lists = __pyx_t_5; __pyx_t_5 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":909 * # Figure out how many bytes it will take to store the references * ref_lists = node[3] * next_len = len(ref_lists) # TODO: use a Py function # <<<<<<<<<<<<<< * if next_len > 0: * # If there are no nodes, we don't need to do any work */ __pyx_t_6 = PyObject_Length(__pyx_v_ref_lists); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_next_len = __pyx_t_6; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":910 * ref_lists = node[3] * next_len = len(ref_lists) # TODO: use a Py function * if next_len > 0: # <<<<<<<<<<<<<< * # If there are no nodes, we don't need to do any work * # Otherwise we will need (len - 1) '\t' characters to separate */ __pyx_t_3 = (__pyx_v_next_len > 0); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":914 * # Otherwise we will need (len - 1) '\t' characters to separate * # the reference lists * refs_len = refs_len + (next_len - 1) # <<<<<<<<<<<<<< * for ref_list in ref_lists: * next_len = len(ref_list) */ __pyx_v_refs_len = (__pyx_v_refs_len + (__pyx_v_next_len - 1)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":915 * # the reference lists * refs_len = refs_len + (next_len - 1) * for ref_list in ref_lists: # <<<<<<<<<<<<<< * next_len = len(ref_list) * if next_len > 0: */ if (PyList_CheckExact(__pyx_v_ref_lists) || PyTuple_CheckExact(__pyx_v_ref_lists)) { __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_ref_lists; __Pyx_INCREF(__pyx_t_5); } else { __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_ref_lists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); } for (;;) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; } else { __pyx_t_8 = PyIter_Next(__pyx_t_5); if (!__pyx_t_8) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_8); } __Pyx_DECREF(__pyx_v_ref_list); __pyx_v_ref_list = __pyx_t_8; __pyx_t_8 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":916 * refs_len = refs_len + (next_len - 1) * for ref_list in ref_lists: * next_len = len(ref_list) # <<<<<<<<<<<<<< * if next_len > 0: * # We will need (len - 1) '\r' characters to separate the */ __pyx_t_9 = PyObject_Length(__pyx_v_ref_list); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_next_len = __pyx_t_9; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":917 * for ref_list in ref_lists: * next_len = len(ref_list) * if next_len > 0: # <<<<<<<<<<<<<< * # We will need (len - 1) '\r' characters to separate the * # references */ __pyx_t_3 = (__pyx_v_next_len > 0); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":920 * # We will need (len - 1) '\r' characters to separate the * # references * refs_len = refs_len + (next_len - 1) # <<<<<<<<<<<<<< * for reference in ref_list: * if (not PyTuple_CheckExact(reference) */ __pyx_v_refs_len = (__pyx_v_refs_len + (__pyx_v_next_len - 1)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":921 * # references * refs_len = refs_len + (next_len - 1) * for reference in ref_list: # <<<<<<<<<<<<<< * if (not PyTuple_CheckExact(reference) * and not StaticTuple_CheckExact(reference)): */ if (PyList_CheckExact(__pyx_v_ref_list) || PyTuple_CheckExact(__pyx_v_ref_list)) { __pyx_t_9 = 0; __pyx_t_8 = __pyx_v_ref_list; __Pyx_INCREF(__pyx_t_8); } else { __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_ref_list); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); } for (;;) { if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; } else if (likely(PyTuple_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; } else { __pyx_t_4 = PyIter_Next(__pyx_t_8); if (!__pyx_t_4) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_v_reference); __pyx_v_reference = __pyx_t_4; __pyx_t_4 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":922 * refs_len = refs_len + (next_len - 1) * for reference in ref_list: * if (not PyTuple_CheckExact(reference) # <<<<<<<<<<<<<< * and not StaticTuple_CheckExact(reference)): * raise TypeError( */ __pyx_t_3 = (!PyTuple_CheckExact(__pyx_v_reference)); if (__pyx_t_3) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":923 * for reference in ref_list: * if (not PyTuple_CheckExact(reference) * and not StaticTuple_CheckExact(reference)): # <<<<<<<<<<<<<< * raise TypeError( * 'We expect references to be tuples not: %s' */ __pyx_t_1 = (!StaticTuple_CheckExact(__pyx_v_reference)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":926 * raise TypeError( * 'We expect references to be tuples not: %s' * % type(reference)) # <<<<<<<<<<<<<< * next_len = len(reference) * if next_len > 0: */ __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)Py_TYPE(__pyx_v_reference))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L16; } __pyx_L16:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":927 * 'We expect references to be tuples not: %s' * % type(reference)) * next_len = len(reference) # <<<<<<<<<<<<<< * if next_len > 0: * # We will need (len - 1) '\x00' characters to */ __pyx_t_11 = PyObject_Length(__pyx_v_reference); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_next_len = __pyx_t_11; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":928 * % type(reference)) * next_len = len(reference) * if next_len > 0: # <<<<<<<<<<<<<< * # We will need (len - 1) '\x00' characters to * # separate the reference key */ __pyx_t_2 = (__pyx_v_next_len > 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":931 * # We will need (len - 1) '\x00' characters to * # separate the reference key * refs_len = refs_len + (next_len - 1) # <<<<<<<<<<<<<< * for ref_bit in reference: * if not PyString_CheckExact(ref_bit): */ __pyx_v_refs_len = (__pyx_v_refs_len + (__pyx_v_next_len - 1)); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":932 * # separate the reference key * refs_len = refs_len + (next_len - 1) * for ref_bit in reference: # <<<<<<<<<<<<<< * if not PyString_CheckExact(ref_bit): * raise TypeError('We expect reference bits' */ if (PyList_CheckExact(__pyx_v_reference) || PyTuple_CheckExact(__pyx_v_reference)) { __pyx_t_11 = 0; __pyx_t_4 = __pyx_v_reference; __Pyx_INCREF(__pyx_t_4); } else { __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_reference); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); } for (;;) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_4)) break; __pyx_t_10 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_10); __pyx_t_11++; } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_4)) break; __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_10); __pyx_t_11++; } else { __pyx_t_10 = PyIter_Next(__pyx_t_4); if (!__pyx_t_10) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_10); } __Pyx_DECREF(__pyx_v_ref_bit); __pyx_v_ref_bit = __pyx_t_10; __pyx_t_10 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":933 * refs_len = refs_len + (next_len - 1) * for ref_bit in reference: * if not PyString_CheckExact(ref_bit): # <<<<<<<<<<<<<< * raise TypeError('We expect reference bits' * ' to be strings not: %s' */ __pyx_t_2 = (!PyString_CheckExact(__pyx_v_ref_bit)); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":936 * raise TypeError('We expect reference bits' * ' to be strings not: %s' * % type(ref_bit)) # <<<<<<<<<<<<<< * refs_len = refs_len + PyString_GET_SIZE(ref_bit) * */ __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)Py_TYPE(__pyx_v_ref_bit))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_10)); __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __pyx_t_10 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_Raise(__pyx_t_10, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L20; } __pyx_L20:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":937 * ' to be strings not: %s' * % type(ref_bit)) * refs_len = refs_len + PyString_GET_SIZE(ref_bit) # <<<<<<<<<<<<<< * * # So we have the (key NULL refs NULL value LF) */ __pyx_v_refs_len = (__pyx_v_refs_len + PyString_GET_SIZE(__pyx_v_ref_bit)); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L17; } __pyx_L17:; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L13; } __pyx_L13:; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L10; } __pyx_L10:; goto __pyx_L9; } __pyx_L9:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":940 * * # So we have the (key NULL refs NULL value LF) * key_len = PyString_Size(string_key) # <<<<<<<<<<<<<< * val = node[2] * if not PyString_CheckExact(val): */ __pyx_v_key_len = PyString_Size(__pyx_v_string_key); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":941 * # So we have the (key NULL refs NULL value LF) * key_len = PyString_Size(string_key) * val = node[2] # <<<<<<<<<<<<<< * if not PyString_CheckExact(val): * raise TypeError('Expected a plain str for value not: %s' */ __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_node, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_v_val); __pyx_v_val = __pyx_t_5; __pyx_t_5 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":942 * key_len = PyString_Size(string_key) * val = node[2] * if not PyString_CheckExact(val): # <<<<<<<<<<<<<< * raise TypeError('Expected a plain str for value not: %s' * % type(val)) */ __pyx_t_2 = (!PyString_CheckExact(__pyx_v_val)); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":944 * if not PyString_CheckExact(val): * raise TypeError('Expected a plain str for value not: %s' * % type(val)) # <<<<<<<<<<<<<< * value = PyString_AS_STRING(val) * value_len = PyString_GET_SIZE(val) */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), ((PyObject *)Py_TYPE(__pyx_v_val))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L21; } __pyx_L21:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":945 * raise TypeError('Expected a plain str for value not: %s' * % type(val)) * value = PyString_AS_STRING(val) # <<<<<<<<<<<<<< * value_len = PyString_GET_SIZE(val) * flat_len = (key_len + 1 + refs_len + 1 + value_len + 1) */ __pyx_v_value = PyString_AS_STRING(__pyx_v_val); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":946 * % type(val)) * value = PyString_AS_STRING(val) * value_len = PyString_GET_SIZE(val) # <<<<<<<<<<<<<< * flat_len = (key_len + 1 + refs_len + 1 + value_len + 1) * line = PyString_FromStringAndSize(NULL, flat_len) */ __pyx_v_value_len = PyString_GET_SIZE(__pyx_v_val); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":947 * value = PyString_AS_STRING(val) * value_len = PyString_GET_SIZE(val) * flat_len = (key_len + 1 + refs_len + 1 + value_len + 1) # <<<<<<<<<<<<<< * line = PyString_FromStringAndSize(NULL, flat_len) * # Get a pointer to the new buffer */ __pyx_v_flat_len = (((((__pyx_v_key_len + 1) + __pyx_v_refs_len) + 1) + __pyx_v_value_len) + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":948 * value_len = PyString_GET_SIZE(val) * flat_len = (key_len + 1 + refs_len + 1 + value_len + 1) * line = PyString_FromStringAndSize(NULL, flat_len) # <<<<<<<<<<<<<< * # Get a pointer to the new buffer * out = PyString_AsString(line) */ __pyx_t_5 = PyString_FromStringAndSize(NULL, __pyx_v_flat_len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_v_line); __pyx_v_line = __pyx_t_5; __pyx_t_5 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":950 * line = PyString_FromStringAndSize(NULL, flat_len) * # Get a pointer to the new buffer * out = PyString_AsString(line) # <<<<<<<<<<<<<< * memcpy(out, PyString_AsString(string_key), key_len) * out = out + key_len */ __pyx_t_13 = PyString_AsString(__pyx_v_line); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_out = __pyx_t_13; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":951 * # Get a pointer to the new buffer * out = PyString_AsString(line) * memcpy(out, PyString_AsString(string_key), key_len) # <<<<<<<<<<<<<< * out = out + key_len * out[0] = c'\0' */ __pyx_t_13 = PyString_AsString(__pyx_v_string_key); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} memcpy(__pyx_v_out, __pyx_t_13, __pyx_v_key_len); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":952 * out = PyString_AsString(line) * memcpy(out, PyString_AsString(string_key), key_len) * out = out + key_len # <<<<<<<<<<<<<< * out[0] = c'\0' * out = out + 1 */ __pyx_v_out = (__pyx_v_out + __pyx_v_key_len); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":953 * memcpy(out, PyString_AsString(string_key), key_len) * out = out + key_len * out[0] = c'\0' # <<<<<<<<<<<<<< * out = out + 1 * if refs_len > 0: */ (__pyx_v_out[0]) = '\x00'; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":954 * out = out + key_len * out[0] = c'\0' * out = out + 1 # <<<<<<<<<<<<<< * if refs_len > 0: * first_ref_list = 1 */ __pyx_v_out = (__pyx_v_out + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":955 * out[0] = c'\0' * out = out + 1 * if refs_len > 0: # <<<<<<<<<<<<<< * first_ref_list = 1 * for ref_list in ref_lists: */ __pyx_t_2 = (__pyx_v_refs_len > 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":956 * out = out + 1 * if refs_len > 0: * first_ref_list = 1 # <<<<<<<<<<<<<< * for ref_list in ref_lists: * if first_ref_list == 0: */ __pyx_v_first_ref_list = 1; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":957 * if refs_len > 0: * first_ref_list = 1 * for ref_list in ref_lists: # <<<<<<<<<<<<<< * if first_ref_list == 0: * out[0] = c'\t' */ if (PyList_CheckExact(__pyx_v_ref_lists) || PyTuple_CheckExact(__pyx_v_ref_lists)) { __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_ref_lists; __Pyx_INCREF(__pyx_t_5); } else { __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_ref_lists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); } for (;;) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; } else { __pyx_t_8 = PyIter_Next(__pyx_t_5); if (!__pyx_t_8) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_8); } __Pyx_DECREF(__pyx_v_ref_list); __pyx_v_ref_list = __pyx_t_8; __pyx_t_8 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":958 * first_ref_list = 1 * for ref_list in ref_lists: * if first_ref_list == 0: # <<<<<<<<<<<<<< * out[0] = c'\t' * out = out + 1 */ __pyx_t_2 = (__pyx_v_first_ref_list == 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":959 * for ref_list in ref_lists: * if first_ref_list == 0: * out[0] = c'\t' # <<<<<<<<<<<<<< * out = out + 1 * first_ref_list = 0 */ (__pyx_v_out[0]) = '\t'; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":960 * if first_ref_list == 0: * out[0] = c'\t' * out = out + 1 # <<<<<<<<<<<<<< * first_ref_list = 0 * first_reference = 1 */ __pyx_v_out = (__pyx_v_out + 1); goto __pyx_L25; } __pyx_L25:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":961 * out[0] = c'\t' * out = out + 1 * first_ref_list = 0 # <<<<<<<<<<<<<< * first_reference = 1 * for reference in ref_list: */ __pyx_v_first_ref_list = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":962 * out = out + 1 * first_ref_list = 0 * first_reference = 1 # <<<<<<<<<<<<<< * for reference in ref_list: * if first_reference == 0: */ __pyx_v_first_reference = 1; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":963 * first_ref_list = 0 * first_reference = 1 * for reference in ref_list: # <<<<<<<<<<<<<< * if first_reference == 0: * out[0] = c'\r' */ if (PyList_CheckExact(__pyx_v_ref_list) || PyTuple_CheckExact(__pyx_v_ref_list)) { __pyx_t_9 = 0; __pyx_t_8 = __pyx_v_ref_list; __Pyx_INCREF(__pyx_t_8); } else { __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_ref_list); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); } for (;;) { if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; } else if (likely(PyTuple_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; } else { __pyx_t_4 = PyIter_Next(__pyx_t_8); if (!__pyx_t_4) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_v_reference); __pyx_v_reference = __pyx_t_4; __pyx_t_4 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":964 * first_reference = 1 * for reference in ref_list: * if first_reference == 0: # <<<<<<<<<<<<<< * out[0] = c'\r' * out = out + 1 */ __pyx_t_2 = (__pyx_v_first_reference == 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":965 * for reference in ref_list: * if first_reference == 0: * out[0] = c'\r' # <<<<<<<<<<<<<< * out = out + 1 * first_reference = 0 */ (__pyx_v_out[0]) = '\r'; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":966 * if first_reference == 0: * out[0] = c'\r' * out = out + 1 # <<<<<<<<<<<<<< * first_reference = 0 * next_len = len(reference) */ __pyx_v_out = (__pyx_v_out + 1); goto __pyx_L28; } __pyx_L28:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":967 * out[0] = c'\r' * out = out + 1 * first_reference = 0 # <<<<<<<<<<<<<< * next_len = len(reference) * for i from 0 <= i < next_len: */ __pyx_v_first_reference = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":968 * out = out + 1 * first_reference = 0 * next_len = len(reference) # <<<<<<<<<<<<<< * for i from 0 <= i < next_len: * if i != 0: */ __pyx_t_11 = PyObject_Length(__pyx_v_reference); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_next_len = __pyx_t_11; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":969 * first_reference = 0 * next_len = len(reference) * for i from 0 <= i < next_len: # <<<<<<<<<<<<<< * if i != 0: * out[0] = c'\x00' */ __pyx_t_11 = __pyx_v_next_len; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":970 * next_len = len(reference) * for i from 0 <= i < next_len: * if i != 0: # <<<<<<<<<<<<<< * out[0] = c'\x00' * out = out + 1 */ __pyx_t_2 = (__pyx_v_i != 0); if (__pyx_t_2) { /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":971 * for i from 0 <= i < next_len: * if i != 0: * out[0] = c'\x00' # <<<<<<<<<<<<<< * out = out + 1 * ref_bit = reference[i] */ (__pyx_v_out[0]) = '\x00'; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":972 * if i != 0: * out[0] = c'\x00' * out = out + 1 # <<<<<<<<<<<<<< * ref_bit = reference[i] * ref_bit_len = PyString_GET_SIZE(ref_bit) */ __pyx_v_out = (__pyx_v_out + 1); goto __pyx_L31; } __pyx_L31:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":973 * out[0] = c'\x00' * out = out + 1 * ref_bit = reference[i] # <<<<<<<<<<<<<< * ref_bit_len = PyString_GET_SIZE(ref_bit) * memcpy(out, PyString_AS_STRING(ref_bit), ref_bit_len) */ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_reference, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_v_ref_bit); __pyx_v_ref_bit = __pyx_t_4; __pyx_t_4 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":974 * out = out + 1 * ref_bit = reference[i] * ref_bit_len = PyString_GET_SIZE(ref_bit) # <<<<<<<<<<<<<< * memcpy(out, PyString_AS_STRING(ref_bit), ref_bit_len) * out = out + ref_bit_len */ __pyx_v_ref_bit_len = PyString_GET_SIZE(__pyx_v_ref_bit); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":975 * ref_bit = reference[i] * ref_bit_len = PyString_GET_SIZE(ref_bit) * memcpy(out, PyString_AS_STRING(ref_bit), ref_bit_len) # <<<<<<<<<<<<<< * out = out + ref_bit_len * out[0] = c'\0' */ memcpy(__pyx_v_out, PyString_AS_STRING(__pyx_v_ref_bit), __pyx_v_ref_bit_len); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":976 * ref_bit_len = PyString_GET_SIZE(ref_bit) * memcpy(out, PyString_AS_STRING(ref_bit), ref_bit_len) * out = out + ref_bit_len # <<<<<<<<<<<<<< * out[0] = c'\0' * out = out + 1 */ __pyx_v_out = (__pyx_v_out + __pyx_v_ref_bit_len); } } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L22; } __pyx_L22:; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":977 * memcpy(out, PyString_AS_STRING(ref_bit), ref_bit_len) * out = out + ref_bit_len * out[0] = c'\0' # <<<<<<<<<<<<<< * out = out + 1 * memcpy(out, value, value_len) */ (__pyx_v_out[0]) = '\x00'; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":978 * out = out + ref_bit_len * out[0] = c'\0' * out = out + 1 # <<<<<<<<<<<<<< * memcpy(out, value, value_len) * out = out + value_len */ __pyx_v_out = (__pyx_v_out + 1); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":979 * out[0] = c'\0' * out = out + 1 * memcpy(out, value, value_len) # <<<<<<<<<<<<<< * out = out + value_len * out[0] = c'\n' */ memcpy(__pyx_v_out, __pyx_v_value, __pyx_v_value_len); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":980 * out = out + 1 * memcpy(out, value, value_len) * out = out + value_len # <<<<<<<<<<<<<< * out[0] = c'\n' * return string_key, line */ __pyx_v_out = (__pyx_v_out + __pyx_v_value_len); /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":981 * memcpy(out, value, value_len) * out = out + value_len * out[0] = c'\n' # <<<<<<<<<<<<<< * return string_key, line */ (__pyx_v_out[0]) = '\n'; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":982 * out = out + value_len * out[0] = c'\n' * return string_key, line # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_string_key); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_string_key); __Pyx_GIVEREF(__pyx_v_string_key); __Pyx_INCREF(__pyx_v_line); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_line); __Pyx_GIVEREF(__pyx_v_line); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("bzrlib._btree_serializer_pyx._flatten_node"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_string_key); __Pyx_DECREF(__pyx_v_ref_lists); __Pyx_DECREF(__pyx_v_ref_list); __Pyx_DECREF(__pyx_v_reference); __Pyx_DECREF(__pyx_v_ref_bit); __Pyx_DECREF(__pyx_v_val); __Pyx_DECREF(__pyx_v_line); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser __pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser; static PyObject *__pyx_tp_new_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o); p->__pyx_vtab = __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser; p->bytes = Py_None; Py_INCREF(Py_None); p->keys = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyObject *o) { struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o; Py_XDECREF(p->bytes); Py_XDECREF(p->keys); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o; if (p->bytes) { e = (*v)(p->bytes, a); if (e) return e; } if (p->keys) { e = (*v)(p->keys, a); if (e) return e; } return 0; } static int __pyx_tp_clear_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser(PyObject *o) { struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *)o; PyObject* tmp; tmp = ((PyObject*)p->bytes); p->bytes = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->keys); p->keys = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyMethodDef __pyx_methods_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser[] = { {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_parse, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_BTreeLeafParser = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_BTreeLeafParser = { 0, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_BTreeLeafParser = { 0, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_BTreeLeafParser = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("bzrlib._btree_serializer_pyx.BTreeLeafParser"), /*tp_name*/ sizeof(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_BTreeLeafParser, /*tp_as_number*/ &__pyx_tp_as_sequence_BTreeLeafParser, /*tp_as_sequence*/ &__pyx_tp_as_mapping_BTreeLeafParser, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_BTreeLeafParser, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ __Pyx_DOCSTR("Parse the leaf nodes of a BTree index.\n\n :ivar bytes: The PyString object containing the uncompressed text for the\n node.\n :ivar key_length: An integer describing how many pieces the keys have for\n this index.\n :ivar ref_list_length: An integer describing how many references this index\n contains.\n :ivar keys: A PyList of keys found in this node.\n\n :ivar _cur_str: A pointer to the start of the next line to parse\n :ivar _end_str: A pointer to the end of bytes\n :ivar _start: Pointer to the location within the current line while\n parsing.\n :ivar _header_found: True when we have parsed the header for this node\n "), /*tp_doc*/ __pyx_tp_traverse_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_traverse*/ __pyx_tp_clear_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static struct __pyx_vtabstruct_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode; static PyObject *__pyx_tp_new_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; p = ((struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)o); p->__pyx_vtab = __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode; p->last_key = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode(PyObject *o) { struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)o; { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_XDECREF(p->last_key); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)o; if (p->last_key) { e = (*v)(p->last_key, a); if (e) return e; } return 0; } static int __pyx_tp_clear_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode(PyObject *o) { struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *p = (struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *)o; PyObject* tmp; tmp = ((PyObject*)p->last_key); p->last_key = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_sq_item_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static PyObject *__pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_min_key(PyObject *o, void *x) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_7min_key___get__(o); } static PyObject *__pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_max_key(PyObject *o, void *x) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_7max_key___get__(o); } static PyObject *__pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_last_key(PyObject *o, void *x) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___get__(o); } static int __pyx_setprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_last_key(PyObject *o, PyObject *v, void *x) { if (v) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___set__(o, v); } else { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_8last_key___del__(o); } } static PyObject *__pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_num_records(PyObject *o, void *x) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_11num_records___get__(o); } static int __pyx_setprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_num_records(PyObject *o, PyObject *v, void *x) { if (v) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_11num_records___set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static PyObject *__pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_common_shift(PyObject *o, void *x) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_12common_shift___get__(o); } static int __pyx_setprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_common_shift(PyObject *o, PyObject *v, void *x) { if (v) { return __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_12common_shift___set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static PyMethodDef __pyx_methods_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode[] = { {__Pyx_NAMESTR("__sizeof__"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___sizeof__, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("all_keys"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_all_keys, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("all_items"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_all_items, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("_get_offset_for_sha1"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__get_offset_for_sha1, METH_O, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("_get_offsets"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__get_offsets, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode[] = { {(char *)"min_key", __pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_min_key, 0, 0, 0}, {(char *)"max_key", __pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_max_key, 0, 0, 0}, {(char *)"last_key", __pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_last_key, __pyx_setprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_last_key, 0, 0}, {(char *)"num_records", __pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_num_records, __pyx_setprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_num_records, 0, 0}, {(char *)"common_shift", __pyx_getprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_common_shift, __pyx_setprop_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode_common_shift, 0, 0}, {0, 0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_GCCHKSHA1LeafNode = { 0, /*nb_add*/ 0, /*nb_subtract*/ 0, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ 0, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_GCCHKSHA1LeafNode = { __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_GCCHKSHA1LeafNode = { __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___len__, /*mp_length*/ __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyBufferProcs __pyx_tp_as_buffer_GCCHKSHA1LeafNode = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_getbuffer*/ #endif #if PY_VERSION_HEX >= 0x02060000 0, /*bf_releasebuffer*/ #endif }; PyTypeObject __pyx_type_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("bzrlib._btree_serializer_pyx.GCCHKSHA1LeafNode"), /*tp_name*/ sizeof(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ &__pyx_tp_as_number_GCCHKSHA1LeafNode, /*tp_as_number*/ &__pyx_tp_as_sequence_GCCHKSHA1LeafNode, /*tp_as_sequence*/ &__pyx_tp_as_mapping_GCCHKSHA1LeafNode, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_GCCHKSHA1LeafNode, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ __Pyx_DOCSTR("Track all the entries for a given leaf node."), /*tp_doc*/ __pyx_tp_traverse_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode, /*tp_traverse*/ __pyx_tp_clear_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pf_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode___init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif }; static PyMethodDef __pyx_methods[] = { {__Pyx_NAMESTR("_parse_leaf_lines"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx__parse_leaf_lines, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("_py_unhexlify"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_unhexlify, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_21_btree_serializer_pyx__py_unhexlify)}, {__Pyx_NAMESTR("_py_hexlify"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_hexlify, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_21_btree_serializer_pyx__py_hexlify)}, {__Pyx_NAMESTR("_py_key_to_sha1"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_key_to_sha1, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_21_btree_serializer_pyx__py_key_to_sha1)}, {__Pyx_NAMESTR("_py_sha1_to_key"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx__py_sha1_to_key, METH_O, __Pyx_DOCSTR(__pyx_doc_6bzrlib_21_btree_serializer_pyx__py_sha1_to_key)}, {__Pyx_NAMESTR("_parse_into_chk"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx__parse_into_chk, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6bzrlib_21_btree_serializer_pyx__parse_into_chk)}, {__Pyx_NAMESTR("_flatten_node"), (PyCFunction)__pyx_pf_6bzrlib_21_btree_serializer_pyx__flatten_node, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6bzrlib_21_btree_serializer_pyx__flatten_node)}, {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("_btree_serializer_pyx"), __Pyx_DOCSTR(__pyx_k_37), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0}, {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0}, {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0}, {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0}, {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0}, {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0}, {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0}, {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0}, {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0}, {&__pyx_kp_u_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0, 0}, {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0}, {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, {&__pyx_kp_u_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0, 0}, {&__pyx_kp_u_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 1, 0, 0}, {&__pyx_kp_u_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0, 0}, {&__pyx_kp_u_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 1, 0, 0}, {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, {&__pyx_n_s__AssertionError, __pyx_k__AssertionError, sizeof(__pyx_k__AssertionError), 0, 0, 1, 1}, {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___compute_common, __pyx_k___compute_common, sizeof(__pyx_k___compute_common), 0, 0, 1, 1}, {&__pyx_n_s___count_records, __pyx_k___count_records, sizeof(__pyx_k___count_records), 0, 0, 1, 1}, {&__pyx_n_s___cur_str, __pyx_k___cur_str, sizeof(__pyx_k___cur_str), 0, 0, 1, 1}, {&__pyx_n_s___end_str, __pyx_k___end_str, sizeof(__pyx_k___end_str), 0, 0, 1, 1}, {&__pyx_n_s___flatten_node, __pyx_k___flatten_node, sizeof(__pyx_k___flatten_node), 0, 0, 1, 1}, {&__pyx_n_s___header_found, __pyx_k___header_found, sizeof(__pyx_k___header_found), 0, 0, 1, 1}, {&__pyx_n_s___lookup_record, __pyx_k___lookup_record, sizeof(__pyx_k___lookup_record), 0, 0, 1, 1}, {&__pyx_n_s___offset_for_sha1, __pyx_k___offset_for_sha1, sizeof(__pyx_k___offset_for_sha1), 0, 0, 1, 1}, {&__pyx_n_s___parse_bytes, __pyx_k___parse_bytes, sizeof(__pyx_k___parse_bytes), 0, 0, 1, 1}, {&__pyx_n_s___parse_into_chk, __pyx_k___parse_into_chk, sizeof(__pyx_k___parse_into_chk), 0, 0, 1, 1}, {&__pyx_n_s___parse_one_entry, __pyx_k___parse_one_entry, sizeof(__pyx_k___parse_one_entry), 0, 0, 1, 1}, {&__pyx_n_s___py_hexlify, __pyx_k___py_hexlify, sizeof(__pyx_k___py_hexlify), 0, 0, 1, 1}, {&__pyx_n_s___py_key_to_sha1, __pyx_k___py_key_to_sha1, sizeof(__pyx_k___py_key_to_sha1), 0, 0, 1, 1}, {&__pyx_n_s___py_sha1_to_key, __pyx_k___py_sha1_to_key, sizeof(__pyx_k___py_sha1_to_key), 0, 0, 1, 1}, {&__pyx_n_s___py_unhexlify, __pyx_k___py_unhexlify, sizeof(__pyx_k___py_unhexlify), 0, 0, 1, 1}, {&__pyx_n_s___record_to_item, __pyx_k___record_to_item, sizeof(__pyx_k___record_to_item), 0, 0, 1, 1}, {&__pyx_n_s___start, __pyx_k___start, sizeof(__pyx_k___start), 0, 0, 1, 1}, {&__pyx_n_s__block_length, __pyx_k__block_length, sizeof(__pyx_k__block_length), 0, 0, 1, 1}, {&__pyx_n_s__block_offset, __pyx_k__block_offset, sizeof(__pyx_k__block_offset), 0, 0, 1, 1}, {&__pyx_n_s__bytes, __pyx_k__bytes, sizeof(__pyx_k__bytes), 0, 0, 1, 1}, {&__pyx_n_s__common_shift, __pyx_k__common_shift, sizeof(__pyx_k__common_shift), 0, 0, 1, 1}, {&__pyx_n_s__extract_key, __pyx_k__extract_key, sizeof(__pyx_k__extract_key), 0, 0, 1, 1}, {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, {&__pyx_n_s__key_length, __pyx_k__key_length, sizeof(__pyx_k__key_length), 0, 0, 1, 1}, {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1}, {&__pyx_n_s__last_key, __pyx_k__last_key, sizeof(__pyx_k__last_key), 0, 0, 1, 1}, {&__pyx_n_s__last_record, __pyx_k__last_record, sizeof(__pyx_k__last_record), 0, 0, 1, 1}, {&__pyx_n_s__node, __pyx_k__node, sizeof(__pyx_k__node), 0, 0, 1, 1}, {&__pyx_n_s__num_records, __pyx_k__num_records, sizeof(__pyx_k__num_records), 0, 0, 1, 1}, {&__pyx_n_s__offsets, __pyx_k__offsets, sizeof(__pyx_k__offsets), 0, 0, 1, 1}, {&__pyx_n_s__parse, __pyx_k__parse, sizeof(__pyx_k__parse), 0, 0, 1, 1}, {&__pyx_n_s__process_line, __pyx_k__process_line, sizeof(__pyx_k__process_line), 0, 0, 1, 1}, {&__pyx_n_s__record_end, __pyx_k__record_end, sizeof(__pyx_k__record_end), 0, 0, 1, 1}, {&__pyx_n_s__record_start, __pyx_k__record_start, sizeof(__pyx_k__record_start), 0, 0, 1, 1}, {&__pyx_n_s__records, __pyx_k__records, sizeof(__pyx_k__records), 0, 0, 1, 1}, {&__pyx_n_s__ref_list_length, __pyx_k__ref_list_length, sizeof(__pyx_k__ref_list_length), 0, 0, 1, 1}, {&__pyx_n_s__reference_lists, __pyx_k__reference_lists, sizeof(__pyx_k__reference_lists), 0, 0, 1, 1}, {&__pyx_n_s__sha1, __pyx_k__sha1, sizeof(__pyx_k__sha1), 0, 0, 1, 1}, {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_AssertionError = __Pyx_GetName(__pyx_b, __pyx_n_s__AssertionError); if (!__pyx_builtin_AssertionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_btree_serializer_pyx(void); /*proto*/ PyMODINIT_FUNC init_btree_serializer_pyx(void) #else PyMODINIT_FUNC PyInit__btree_serializer_pyx(void); /*proto*/ PyMODINIT_FUNC PyInit__btree_serializer_pyx(void) #endif { PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; #if CYTHON_REFNANNY void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__btree_serializer_pyx(void)", __LINE__, __FILE__); #endif __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __pyx_binding_PyCFunctionType_USED if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_btree_serializer_pyx"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_37), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_bzrlib___btree_serializer_pyx) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = &__pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser; #if PY_MAJOR_VERSION >= 3 __pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.extract_key = (PyObject *(*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *, char *))__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_extract_key; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.process_line = (int (*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser *))__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_process_line; #else *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.extract_key = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_extract_key; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.process_line = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_15BTreeLeafParser_process_line; #endif if (PyType_Ready(&__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser.tp_dict, __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "BTreeLeafParser", (PyObject *)&__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser = &__pyx_type_6bzrlib_21_btree_serializer_pyx_BTreeLeafParser; __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode = &__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode; #if PY_MAJOR_VERSION >= 3 __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._record_to_value_and_refs = (StaticTuple *(*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__record_to_value_and_refs; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._record_to_item = (StaticTuple *(*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__record_to_item; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._lookup_record = (__pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *(*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__lookup_record; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._count_records = (int (*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *, char *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__count_records; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._parse_bytes = (PyObject *(*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, PyObject *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__parse_bytes; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._parse_one_entry = (char *(*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *, char *, __pyx_t_6bzrlib_21_btree_serializer_pyx_gc_chk_sha1_record *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__parse_one_entry; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._offset_for_sha1 = (int (*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *, char *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__offset_for_sha1; __pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._compute_common = (PyObject *(*)(struct __pyx_obj_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode *))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__compute_common; #else *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._record_to_value_and_refs = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__record_to_value_and_refs; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._record_to_item = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__record_to_item; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._lookup_record = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__lookup_record; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._count_records = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__count_records; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._parse_bytes = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__parse_bytes; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._parse_one_entry = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__parse_one_entry; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._offset_for_sha1 = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__offset_for_sha1; *(void(**)(void))&__pyx_vtable_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode._compute_common = (void(*)(void))__pyx_f_6bzrlib_21_btree_serializer_pyx_17GCCHKSHA1LeafNode__compute_common; #endif if (PyType_Ready(&__pyx_type_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode.tp_dict, __pyx_vtabptr_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "GCCHKSHA1LeafNode", (PyObject *)&__pyx_type_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode = &__pyx_type_6bzrlib_21_btree_serializer_pyx_GCCHKSHA1LeafNode; /*--- Type import code ---*/ __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = __Pyx_ImportType("bzrlib._static_tuple_c", "StaticTuple", sizeof(StaticTuple), 0); if (unlikely(!__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":77 * # have to worry about exception checking. * ## extern cdef class StaticTuple * import sys # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":120 * * # This sets up the StaticTuple C_API functionality * import_static_tuple_c() # <<<<<<<<<<<<<< * * */ __pyx_t_2 = import_static_tuple_c(); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":347 * cdef int _unhexbuf[256] * cdef char *_hexbuf * _hexbuf = '0123456789abcdef' # <<<<<<<<<<<<<< * * cdef _populate_unhexbuf(): */ __pyx_v_6bzrlib_21_btree_serializer_pyx__hexbuf = __pyx_k__0123456789abcdef; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":359 * for i from 10 <= i < 16: # ABCDEF => 10, 11, 12, 13, 14, 15, 16 * _unhexbuf[(i - 10 + c'A')] = i * _populate_unhexbuf() # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __pyx_f_6bzrlib_21_btree_serializer_pyx__populate_unhexbuf(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "/home/vila/src/bzr/integration/trunk/bzrlib/_btree_serializer_pyx.pyx":1 * # Copyright (C) 2008, 2009, 2010 Canonical Ltd # <<<<<<<<<<<<<< * # * # This program is free software; you can redistribute it and/or modify */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s___py_unhexlify); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_38), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s___py_hexlify); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_39), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s___py_key_to_sha1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_40), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s___py_sha1_to_key); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_41), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s___parse_into_chk); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_42), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetAttr(__pyx_m, __pyx_n_s___flatten_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_43), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { __Pyx_AddTraceback("init bzrlib._btree_serializer_pyx"); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init bzrlib._btree_serializer_pyx"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) PyErr_SetObject(PyExc_NameError, name); return result; } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *number, *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, #if PY_VERSION_HEX < 0x02050000 "%s() takes %s %d positional argument%s (%d given)", #else "%s() takes %s %zd positional argument%s (%zd given)", #endif func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise , */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return PyLong_AsUnsignedLong(x); } else { return PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return PyLong_AsUnsignedLongLong(x); } else { return PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return PyLong_AsUnsignedLong(x); } else { return PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return PyLong_AsUnsignedLongLong(x); } else { return PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return PyLong_AsUnsignedLong(x); } else { return PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return PyLong_AsUnsignedLongLong(x); } else { return PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; Py_DECREF(ob); return 0; bad: Py_XDECREF(ob); return -1; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; #if PY_MAJOR_VERSION < 3 py_name = PyString_FromString(class_name); #else py_name = PyUnicode_FromString(class_name); #endif if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 PyErr_Warn(NULL, warning); #else PyErr_WarnEx(NULL, warning, 0); #endif } else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; #if PY_MAJOR_VERSION < 3 py_name = PyString_FromString(name); #else py_name = PyUnicode_FromString(name); #endif if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */