/* Generated by Pyrex 0.9.8.5 on Thu Nov 25 16:59:22 2010 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#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 PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)	PyInt_AsLong(o)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "stdlib.h"
#include "string.h"


typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

static char __pyx_mdoc[] = "Pyrex extensions to knit parsing.";

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations from bzrlib._knit_load_data_pyx */


/* Declarations from implementation of bzrlib._knit_load_data_pyx */

struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader {
  PyObject_HEAD
  struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *__pyx_vtab;
  PyObject *kndx;
  PyObject *fp;
  PyObject *cache;
  PyObject *history;
  char *cur_str;
  char *end_str;
  int history_len;
};


struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader {
  int (*validate)(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *);
  PyObject *(*process_options)(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *,char *,char *);
  PyObject *(*process_parents)(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *,char *,char *);
  int (*process_one_record)(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *,char *,char *);
  int (*process_next_record)(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *);
};
static struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *__pyx_vtabptr_6bzrlib_19_knit_load_data_pyx_KnitIndexReader;

static PyTypeObject *__pyx_ptype_6bzrlib_19_knit_load_data_pyx_KnitIndexReader = 0;
static int __pyx_f_6bzrlib_19_knit_load_data_pyx_string_to_int_safe(char *,char *,int *); /*proto*/

static char __pyx_k1[] = "%r is not a valid integer";
static char __pyx_k2[] = "_cache";
static char __pyx_k3[] = "_history";
static char __pyx_k4[] = "kndx._cache must be a python dict";
static char __pyx_k5[] = "kndx._history must be a python list";
static char __pyx_k6[] = "Parent index refers to a revision which does not exist yet. %d > %d";
static char __pyx_k7[] = "errors";
static char __pyx_k8[] = "KnitCorrupt";
static char __pyx_k9[] = "_filename";
static char __pyx_k10[] = "line %r: %s";
static char __pyx_k11[] = "check_header";
static char __pyx_k12[] = "read";
static char __pyx_k13[] = "sys";
static char __pyx_k14[] = "bzrlib";

static PyObject *__pyx_n_KnitCorrupt;
static PyObject *__pyx_n__cache;
static PyObject *__pyx_n__filename;
static PyObject *__pyx_n__history;
static PyObject *__pyx_n_bzrlib;
static PyObject *__pyx_n_check_header;
static PyObject *__pyx_n_errors;
static PyObject *__pyx_n_read;
static PyObject *__pyx_n_sys;

static PyObject *__pyx_k1p;
static PyObject *__pyx_k4p;
static PyObject *__pyx_k5p;
static PyObject *__pyx_k6p;
static PyObject *__pyx_k10p;

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_KnitCorrupt, 1, __pyx_k8, sizeof(__pyx_k8)},
  {&__pyx_n__cache, 1, __pyx_k2, sizeof(__pyx_k2)},
  {&__pyx_n__filename, 1, __pyx_k9, sizeof(__pyx_k9)},
  {&__pyx_n__history, 1, __pyx_k3, sizeof(__pyx_k3)},
  {&__pyx_n_bzrlib, 1, __pyx_k14, sizeof(__pyx_k14)},
  {&__pyx_n_check_header, 1, __pyx_k11, sizeof(__pyx_k11)},
  {&__pyx_n_errors, 1, __pyx_k7, sizeof(__pyx_k7)},
  {&__pyx_n_read, 1, __pyx_k12, sizeof(__pyx_k12)},
  {&__pyx_n_sys, 1, __pyx_k13, sizeof(__pyx_k13)},
  {&__pyx_k1p, 0, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_k4p, 0, __pyx_k4, sizeof(__pyx_k4)},
  {&__pyx_k5p, 0, __pyx_k5, sizeof(__pyx_k5)},
  {&__pyx_k6p, 0, __pyx_k6, sizeof(__pyx_k6)},
  {&__pyx_k10p, 0, __pyx_k10, sizeof(__pyx_k10)},
  {0, 0, 0, 0}
};



/* Implementation of bzrlib._knit_load_data_pyx */

static int __pyx_f_6bzrlib_19_knit_load_data_pyx_string_to_int_safe(char *__pyx_v_s,char *__pyx_v_end,int *__pyx_v_out) {
  char *__pyx_v_integer_end;
  PyObject *__pyx_v_py_s;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  __pyx_v_py_s = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":69 */
  (__pyx_v_out[0]) = ((int)strtol(__pyx_v_s,(&__pyx_v_integer_end),10));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":70 */
  __pyx_1 = (__pyx_v_integer_end != __pyx_v_end);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":71 */
    __pyx_2 = PyString_FromStringAndSize(__pyx_v_s,(__pyx_v_end - __pyx_v_s)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
    Py_DECREF(__pyx_v_py_s);
    __pyx_v_py_s = __pyx_2;
    __pyx_2 = 0;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":72 */
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
    Py_INCREF(__pyx_v_py_s);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_py_s);
    __pyx_3 = PyNumber_Remainder(__pyx_k1p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":73 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.string_to_int_safe");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_py_s);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kndx = 0;
  PyObject *__pyx_v_fp = 0;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"kndx","fp",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_kndx, &__pyx_v_fp)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_kndx);
  Py_INCREF(__pyx_v_fp);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":90 */
  Py_INCREF(__pyx_v_kndx);
  Py_DECREF(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->kndx);
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->kndx = __pyx_v_kndx;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":91 */
  Py_INCREF(__pyx_v_fp);
  Py_DECREF(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->fp);
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->fp = __pyx_v_fp;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":93 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_kndx, __pyx_n__cache); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->cache);
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->cache = __pyx_1;
  __pyx_1 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":94 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_kndx, __pyx_n__history); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->history);
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->history = __pyx_1;
  __pyx_1 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":96 */
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->cur_str = NULL;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":97 */
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->end_str = NULL;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":98 */
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->history_len = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.KnitIndexReader.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_kndx);
  Py_DECREF(__pyx_v_fp);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_validate(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *__pyx_v_self) {
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":101 */
  __pyx_1 = (!PyDict_CheckExact(__pyx_v_self->cache));
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
    Py_INCREF(__pyx_k4p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k4p);
    __pyx_3 = PyObject_CallObject(PyExc_TypeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":103 */
  __pyx_1 = (!PyList_CheckExact(__pyx_v_self->history));
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
    Py_INCREF(__pyx_k5p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k5p);
    __pyx_3 = PyObject_CallObject(PyExc_TypeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":105 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.KnitIndexReader.validate");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_options(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *__pyx_v_self,char *__pyx_v_option_str,char *__pyx_v_end) {
  char *__pyx_v_next;
  PyObject *__pyx_v_final_options;
  PyObject *__pyx_v_next_option;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  Py_INCREF(__pyx_v_self);
  __pyx_v_final_options = Py_None; Py_INCREF(Py_None);
  __pyx_v_next_option = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":119 */
  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
  Py_DECREF(__pyx_v_final_options);
  __pyx_v_final_options = __pyx_1;
  __pyx_1 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":121 */
  while (1) {
    __pyx_2 = (__pyx_v_option_str < __pyx_v_end);
    if (!__pyx_2) break;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":122 */
    __pyx_v_next = ((char *)memchr(__pyx_v_option_str,',',(__pyx_v_end - __pyx_v_option_str)));

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":123 */
    __pyx_2 = (__pyx_v_next == NULL);
    if (__pyx_2) {
      __pyx_v_next = __pyx_v_end;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":125 */
    __pyx_1 = PyString_FromStringAndSize(__pyx_v_option_str,(__pyx_v_next - __pyx_v_option_str)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
    Py_DECREF(__pyx_v_next_option);
    __pyx_v_next_option = __pyx_1;
    __pyx_1 = 0;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":127 */
    __pyx_2 = PyList_Append(__pyx_v_final_options,__pyx_v_next_option); if (__pyx_2 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":130 */
    __pyx_v_option_str = (__pyx_v_next + 1);
  }

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":132 */
  Py_INCREF(__pyx_v_final_options);
  __pyx_r = __pyx_v_final_options;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.KnitIndexReader.process_options");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_final_options);
  Py_DECREF(__pyx_v_next_option);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_parents(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *__pyx_v_self,char *__pyx_v_parent_str,char *__pyx_v_end) {
  char *__pyx_v_next;
  int __pyx_v_int_parent;
  PyObject *__pyx_v_parents;
  PyObject *__pyx_v_parent;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_parents = Py_None; Py_INCREF(Py_None);
  __pyx_v_parent = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":151 */
  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
  Py_DECREF(__pyx_v_parents);
  __pyx_v_parents = __pyx_1;
  __pyx_1 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":152 */
  while (1) {
    __pyx_2 = (__pyx_v_parent_str <= __pyx_v_end);
    if (!__pyx_2) break;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":153 */
    __pyx_v_next = ((char *)memchr(__pyx_v_parent_str,' ',(__pyx_v_end - __pyx_v_parent_str)));

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":154 */
    __pyx_2 = (__pyx_v_next == NULL);
    if (!__pyx_2) {
      __pyx_2 = (__pyx_v_next >= __pyx_v_end);
      if (!__pyx_2) {
        __pyx_2 = (__pyx_v_next == __pyx_v_parent_str);
      }
    }
    if (__pyx_2) {
      goto __pyx_L3;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":157 */
    __pyx_2 = ((__pyx_v_parent_str[0]) == '.');
    if (__pyx_2) {

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":159 */
      __pyx_v_parent_str = (__pyx_v_parent_str + 1);

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":160 */
      __pyx_1 = PyString_FromStringAndSize(__pyx_v_parent_str,(__pyx_v_next - __pyx_v_parent_str)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
      Py_DECREF(__pyx_v_parent);
      __pyx_v_parent = __pyx_1;
      __pyx_1 = 0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":164 */
      __pyx_2 = __pyx_f_6bzrlib_19_knit_load_data_pyx_string_to_int_safe(__pyx_v_parent_str,__pyx_v_next,(&__pyx_v_int_parent)); if (__pyx_2 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":166 */
      __pyx_2 = (__pyx_v_int_parent >= __pyx_v_self->history_len);
      if (__pyx_2) {
        __pyx_1 = PyInt_FromLong(__pyx_v_int_parent); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
        __pyx_3 = PyInt_FromLong(__pyx_v_self->history_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
        __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
        PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
        __pyx_1 = 0;
        __pyx_3 = 0;
        __pyx_1 = PyNumber_Remainder(__pyx_k6p, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
        __pyx_1 = 0;
        __pyx_4 = PyObject_CallObject(PyExc_IndexError, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __Pyx_Raise(__pyx_4, 0, 0);
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":170 */
      __pyx_1 = PyList_GET_ITEM(__pyx_v_self->history,__pyx_v_int_parent); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
      Py_DECREF(__pyx_v_parent);
      __pyx_v_parent = __pyx_1;
      __pyx_1 = 0;

      /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":172 */
      Py_INCREF(__pyx_v_parent);
    }
    __pyx_L5:;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":173 */
    __pyx_2 = PyList_Append(__pyx_v_parents,__pyx_v_parent); if (__pyx_2 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":174 */
    __pyx_v_parent_str = (__pyx_v_next + 1);
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":175 */
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
  Py_INCREF(__pyx_v_parents);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_parents);
  __pyx_4 = PyObject_CallObject(((PyObject *)(&PyTuple_Type)), __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_r = __pyx_4;
  __pyx_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.KnitIndexReader.process_parents");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_parents);
  Py_DECREF(__pyx_v_parent);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_one_record(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *__pyx_v_self,char *__pyx_v_start,char *__pyx_v_end) {
  char *__pyx_v_version_id_str;
  int __pyx_v_version_id_size;
  char *__pyx_v_option_str;
  char *__pyx_v_option_end;
  char *__pyx_v_pos_str;
  int __pyx_v_pos;
  char *__pyx_v_size_str;
  int __pyx_v_size;
  char *__pyx_v_parent_str;
  void *__pyx_v_cache_entry;
  PyObject *__pyx_v_version_id;
  PyObject *__pyx_v_options;
  PyObject *__pyx_v_parents;
  PyObject *__pyx_v_e;
  PyObject *__pyx_v_py_line;
  PyObject *__pyx_v_index;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  PyObject *__pyx_7 = 0;
  PyObject *__pyx_8 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_version_id = Py_None; Py_INCREF(Py_None);
  __pyx_v_options = Py_None; Py_INCREF(Py_None);
  __pyx_v_parents = Py_None; Py_INCREF(Py_None);
  __pyx_v_e = Py_None; Py_INCREF(Py_None);
  __pyx_v_py_line = Py_None; Py_INCREF(Py_None);
  __pyx_v_index = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":191 */
  __pyx_v_version_id_str = __pyx_v_start;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":192 */
  __pyx_v_option_str = ((char *)memchr(__pyx_v_version_id_str,' ',(__pyx_v_end - __pyx_v_version_id_str)));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":193 */
  __pyx_1 = (__pyx_v_option_str == NULL);
  if (!__pyx_1) {
    __pyx_1 = (__pyx_v_option_str >= __pyx_v_end);
  }
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":196 */
  __pyx_v_version_id_size = (__pyx_v_option_str - __pyx_v_version_id_str);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":198 */
  __pyx_v_option_str = (__pyx_v_option_str + 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":200 */
  __pyx_v_pos_str = ((char *)memchr(__pyx_v_option_str,' ',(__pyx_v_end - __pyx_v_option_str)));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":201 */
  __pyx_1 = (__pyx_v_pos_str == NULL);
  if (!__pyx_1) {
    __pyx_1 = (__pyx_v_pos_str >= __pyx_v_end);
  }
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":204 */
  __pyx_v_option_end = __pyx_v_pos_str;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":205 */
  __pyx_v_pos_str = (__pyx_v_pos_str + 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":207 */
  __pyx_v_size_str = ((char *)memchr(__pyx_v_pos_str,' ',(__pyx_v_end - __pyx_v_pos_str)));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":208 */
  __pyx_1 = (__pyx_v_size_str == NULL);
  if (!__pyx_1) {
    __pyx_1 = (__pyx_v_size_str >= __pyx_v_end);
  }
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":211 */
  __pyx_v_size_str = (__pyx_v_size_str + 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":213 */
  __pyx_v_parent_str = ((char *)memchr(__pyx_v_size_str,' ',(__pyx_v_end - __pyx_v_size_str)));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":214 */
  __pyx_1 = (__pyx_v_parent_str == NULL);
  if (!__pyx_1) {
    __pyx_1 = (__pyx_v_parent_str >= __pyx_v_end);
  }
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":217 */
  __pyx_v_parent_str = (__pyx_v_parent_str + 1);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":219 */
  __pyx_2 = PyString_FromStringAndSize(__pyx_v_version_id_str,__pyx_v_version_id_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; goto __pyx_L1;}
  Py_DECREF(__pyx_v_version_id);
  __pyx_v_version_id = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":221 */
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self->__pyx_vtab)->process_options(__pyx_v_self,__pyx_v_option_str,__pyx_v_option_end); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}
  Py_DECREF(__pyx_v_options);
  __pyx_v_options = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":223 */
  /*try:*/ {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":224 */
    __pyx_1 = __pyx_f_6bzrlib_19_knit_load_data_pyx_string_to_int_safe(__pyx_v_pos_str,(__pyx_v_size_str - 1),(&__pyx_v_pos)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L6;}

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":225 */
    __pyx_1 = __pyx_f_6bzrlib_19_knit_load_data_pyx_string_to_int_safe(__pyx_v_size_str,(__pyx_v_parent_str - 1),(&__pyx_v_size)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L6;}

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":226 */
    __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self->__pyx_vtab)->process_parents(__pyx_v_self,__pyx_v_parent_str,__pyx_v_end); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L6;}
    Py_DECREF(__pyx_v_parents);
    __pyx_v_parents = __pyx_2;
    __pyx_2 = 0;
  }
  goto __pyx_L7;
  __pyx_L6:;
  Py_XDECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":227 */
  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
  Py_INCREF(PyExc_ValueError);
  PyTuple_SET_ITEM(__pyx_2, 0, PyExc_ValueError);
  Py_INCREF(PyExc_IndexError);
  PyTuple_SET_ITEM(__pyx_2, 1, PyExc_IndexError);
  __pyx_1 = PyErr_ExceptionMatches(__pyx_2);
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__pyx_1) {
    __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.process_one_record");
    if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
    Py_INCREF(__pyx_3);
    Py_DECREF(__pyx_v_e);
    __pyx_v_e = __pyx_3;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":228 */
    __pyx_5 = PyString_FromStringAndSize(__pyx_v_start,(__pyx_v_end - __pyx_v_start)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
    Py_DECREF(__pyx_v_py_line);
    __pyx_v_py_line = __pyx_5;
    __pyx_5 = 0;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":229 */
    __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_errors); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
    __pyx_6 = PyObject_GetAttr(__pyx_5, __pyx_n_KnitCorrupt); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_5 = PyObject_GetAttr(__pyx_v_self->kndx, __pyx_n__filename); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
    __pyx_7 = PyTuple_New(2); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
    Py_INCREF(__pyx_v_py_line);
    PyTuple_SET_ITEM(__pyx_7, 0, __pyx_v_py_line);
    Py_INCREF(__pyx_v_e);
    PyTuple_SET_ITEM(__pyx_7, 1, __pyx_v_e);
    __pyx_8 = PyNumber_Remainder(__pyx_k10p, __pyx_7); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    __pyx_7 = PyTuple_New(2); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_7, 0, __pyx_5);
    PyTuple_SET_ITEM(__pyx_7, 1, __pyx_8);
    __pyx_5 = 0;
    __pyx_8 = 0;
    __pyx_5 = PyObject_CallObject(__pyx_6, __pyx_7); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    __Pyx_Raise(__pyx_5, 0, 0);
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    goto __pyx_L7;
  }
  goto __pyx_L1;
  __pyx_L7:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":232 */
  __pyx_v_cache_entry = PyDict_GetItem(__pyx_v_self->cache,__pyx_v_version_id);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":233 */
  __pyx_1 = (__pyx_v_cache_entry == NULL);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":234 */
    __pyx_1 = PyList_Append(__pyx_v_self->history,__pyx_v_version_id); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":235 */
    __pyx_8 = PyInt_FromLong(__pyx_v_self->history_len); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
    Py_DECREF(__pyx_v_index);
    __pyx_v_index = __pyx_8;
    __pyx_8 = 0;

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":236 */
    __pyx_v_self->history_len = (__pyx_v_self->history_len + 1);
    goto __pyx_L8;
  }
  /*else*/ {
    Py_INCREF(((PyObject *)PyTuple_GET_ITEM(__pyx_v_cache_entry,5)));
    Py_DECREF(__pyx_v_index);
    __pyx_v_index = ((PyObject *)PyTuple_GET_ITEM(__pyx_v_cache_entry,5));
  }
  __pyx_L8:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":242 */
  __pyx_6 = PyInt_FromLong(__pyx_v_pos); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;}
  __pyx_7 = PyInt_FromLong(__pyx_v_size); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(6); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; goto __pyx_L1;}
  Py_INCREF(__pyx_v_version_id);
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_version_id);
  Py_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_v_options);
  PyTuple_SET_ITEM(__pyx_5, 2, __pyx_6);
  PyTuple_SET_ITEM(__pyx_5, 3, __pyx_7);
  Py_INCREF(__pyx_v_parents);
  PyTuple_SET_ITEM(__pyx_5, 4, __pyx_v_parents);
  Py_INCREF(__pyx_v_index);
  PyTuple_SET_ITEM(__pyx_5, 5, __pyx_v_index);
  __pyx_6 = 0;
  __pyx_7 = 0;
  __pyx_1 = PyDict_SetItem(__pyx_v_self->cache,__pyx_v_version_id,__pyx_5); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}
  Py_DECREF(__pyx_5); __pyx_5 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":250 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  Py_XDECREF(__pyx_7);
  Py_XDECREF(__pyx_8);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.KnitIndexReader.process_one_record");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_version_id);
  Py_DECREF(__pyx_v_options);
  Py_DECREF(__pyx_v_parents);
  Py_DECREF(__pyx_v_e);
  Py_DECREF(__pyx_v_py_line);
  Py_DECREF(__pyx_v_index);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_next_record(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *__pyx_v_self) {
  char *__pyx_v_last;
  char *__pyx_v_start;
  int __pyx_r;
  int __pyx_1;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":257 */
  __pyx_v_start = __pyx_v_self->cur_str;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":259 */
  __pyx_v_last = ((char *)memchr(__pyx_v_start,'\n',(__pyx_v_self->end_str - __pyx_v_start)));

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":260 */
  __pyx_1 = (__pyx_v_last == NULL);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":262 */
    __pyx_v_last = (__pyx_v_self->end_str - 1);

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":263 */
    __pyx_v_self->cur_str = __pyx_v_self->end_str;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":267 */
    __pyx_v_self->cur_str = (__pyx_v_last + 1);

    /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":268 */
    __pyx_v_last = (__pyx_v_last - 1);
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":270 */
  __pyx_1 = (__pyx_v_last <= __pyx_v_start);
  if (!__pyx_1) {
    __pyx_1 = ((__pyx_v_last[0]) != ':');
  }
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":274 */
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self->__pyx_vtab)->process_one_record(__pyx_v_self,__pyx_v_start,__pyx_v_last); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.KnitIndexReader.process_next_record");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_text_size;
  PyObject *__pyx_v_text;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_text = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":279 */
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->__pyx_vtab)->validate(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":281 */
  __pyx_2 = PyObject_GetAttr(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->kndx, __pyx_n_check_header); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
  Py_INCREF(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->fp);
  PyTuple_SET_ITEM(__pyx_3, 0, ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->fp);
  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":291 */
  __pyx_2 = PyObject_GetAttr(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->fp, __pyx_n_read); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_text);
  __pyx_v_text = __pyx_3;
  __pyx_3 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":292 */
  __pyx_v_text_size = PyString_Size(__pyx_v_text);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":293 */
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->cur_str = PyString_AsString(__pyx_v_text);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":295 */
  ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->end_str = (((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->cur_str + __pyx_v_text_size);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":297 */
  while (1) {
    __pyx_1 = (((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->cur_str < ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->end_str);
    if (!__pyx_1) break;
    __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)->__pyx_vtab)->process_next_record(((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)__pyx_v_self)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; goto __pyx_L1;}
  }

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx.KnitIndexReader.read");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_text);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_19_knit_load_data_pyx__load_data_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6bzrlib_19_knit_load_data_pyx__load_data_c[] = "Load the knit index file into memory.";
static PyObject *__pyx_f_6bzrlib_19_knit_load_data_pyx__load_data_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_kndx = 0;
  PyObject *__pyx_v_fp = 0;
  PyObject *__pyx_v_reader;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"kndx","fp",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_kndx, &__pyx_v_fp)) return 0;
  Py_INCREF(__pyx_v_kndx);
  Py_INCREF(__pyx_v_fp);
  __pyx_v_reader = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":303 */
  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
  Py_INCREF(__pyx_v_kndx);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_kndx);
  Py_INCREF(__pyx_v_fp);
  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_fp);
  __pyx_2 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_19_knit_load_data_pyx_KnitIndexReader), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_reader);
  __pyx_v_reader = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":304 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_read); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx._load_data_c");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_reader);
  Py_DECREF(__pyx_v_kndx);
  Py_DECREF(__pyx_v_fp);
  return __pyx_r;
}
static struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader __pyx_vtable_6bzrlib_19_knit_load_data_pyx_KnitIndexReader;

static PyObject *__pyx_tp_new_6bzrlib_19_knit_load_data_pyx_KnitIndexReader(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)o);
  *(struct __pyx_vtabstruct_6bzrlib_19_knit_load_data_pyx_KnitIndexReader **)&p->__pyx_vtab = __pyx_vtabptr_6bzrlib_19_knit_load_data_pyx_KnitIndexReader;
  p->kndx = Py_None; Py_INCREF(Py_None);
  p->fp = Py_None; Py_INCREF(Py_None);
  p->cache = Py_None; Py_INCREF(Py_None);
  p->history = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6bzrlib_19_knit_load_data_pyx_KnitIndexReader(PyObject *o) {
  struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *p = (struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)o;
  Py_XDECREF(p->kndx);
  Py_XDECREF(p->fp);
  Py_XDECREF(p->cache);
  Py_XDECREF(p->history);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_6bzrlib_19_knit_load_data_pyx_KnitIndexReader(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *p = (struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)o;
  if (p->kndx) {
    e = (*v)(p->kndx, a); if (e) return e;
  }
  if (p->fp) {
    e = (*v)(p->fp, a); if (e) return e;
  }
  if (p->cache) {
    e = (*v)(p->cache, a); if (e) return e;
  }
  if (p->history) {
    e = (*v)(p->history, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6bzrlib_19_knit_load_data_pyx_KnitIndexReader(PyObject *o) {
  struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *p = (struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader *)o;
  PyObject *t;
  t = p->kndx; 
  p->kndx = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->fp; 
  p->fp = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->cache; 
  p->cache = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->history; 
  p->history = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  return 0;
}

static struct PyMethodDef __pyx_methods_6bzrlib_19_knit_load_data_pyx_KnitIndexReader[] = {
  {"read", (PyCFunction)__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_read, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_KnitIndexReader = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  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*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  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_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_KnitIndexReader = {
  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_KnitIndexReader = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_KnitIndexReader = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_6bzrlib_19_knit_load_data_pyx_KnitIndexReader = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "bzrlib._knit_load_data_pyx.KnitIndexReader", /*tp_name*/
  sizeof(struct __pyx_obj_6bzrlib_19_knit_load_data_pyx_KnitIndexReader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6bzrlib_19_knit_load_data_pyx_KnitIndexReader, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_KnitIndexReader, /*tp_as_number*/
  &__pyx_tp_as_sequence_KnitIndexReader, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_KnitIndexReader, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_KnitIndexReader, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6bzrlib_19_knit_load_data_pyx_KnitIndexReader, /*tp_traverse*/
  __pyx_tp_clear_6bzrlib_19_knit_load_data_pyx_KnitIndexReader, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6bzrlib_19_knit_load_data_pyx_KnitIndexReader, /*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_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6bzrlib_19_knit_load_data_pyx_KnitIndexReader, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {"_load_data_c", (PyCFunction)__pyx_f_6bzrlib_19_knit_load_data_pyx__load_data_c, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_19_knit_load_data_pyx__load_data_c},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC init_knit_load_data_pyx(void); /*proto*/
PyMODINIT_FUNC init_knit_load_data_pyx(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_knit_load_data_pyx", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  Py_INCREF(__pyx_m);
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  __pyx_vtabptr_6bzrlib_19_knit_load_data_pyx_KnitIndexReader = &__pyx_vtable_6bzrlib_19_knit_load_data_pyx_KnitIndexReader;
  *(void(**)(void))&__pyx_vtable_6bzrlib_19_knit_load_data_pyx_KnitIndexReader.validate = (void(*)(void))__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_validate;
  *(void(**)(void))&__pyx_vtable_6bzrlib_19_knit_load_data_pyx_KnitIndexReader.process_options = (void(*)(void))__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_options;
  *(void(**)(void))&__pyx_vtable_6bzrlib_19_knit_load_data_pyx_KnitIndexReader.process_parents = (void(*)(void))__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_parents;
  *(void(**)(void))&__pyx_vtable_6bzrlib_19_knit_load_data_pyx_KnitIndexReader.process_one_record = (void(*)(void))__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_one_record;
  *(void(**)(void))&__pyx_vtable_6bzrlib_19_knit_load_data_pyx_KnitIndexReader.process_next_record = (void(*)(void))__pyx_f_6bzrlib_19_knit_load_data_pyx_15KnitIndexReader_process_next_record;
  __pyx_type_6bzrlib_19_knit_load_data_pyx_KnitIndexReader.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&__pyx_type_6bzrlib_19_knit_load_data_pyx_KnitIndexReader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_6bzrlib_19_knit_load_data_pyx_KnitIndexReader.tp_dict, __pyx_vtabptr_6bzrlib_19_knit_load_data_pyx_KnitIndexReader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "KnitIndexReader", (PyObject *)&__pyx_type_6bzrlib_19_knit_load_data_pyx_KnitIndexReader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
  __pyx_ptype_6bzrlib_19_knit_load_data_pyx_KnitIndexReader = &__pyx_type_6bzrlib_19_knit_load_data_pyx_KnitIndexReader;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":19 */
  __pyx_1 = __Pyx_Import(__pyx_n_sys, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":21 */
  __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
  Py_INCREF(__pyx_n_errors);
  PyList_SET_ITEM(__pyx_1, 0, __pyx_n_errors);
  __pyx_2 = __Pyx_Import(__pyx_n_bzrlib, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_errors); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_errors, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/vila/src/bzr/releases/prepare-2.2.2/bzrlib/_knit_load_data_pyx.pyx":301 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._knit_load_data_pyx");
}

static char *__pyx_filenames[] = {
  "_knit_load_data_pyx.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

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 <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) type->ob_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
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_Get();
    PyErr_Fetch(type, value, tb);
    PyErr_NormalizeException(type, value, tb);
    if (PyErr_Occurred())
        goto bad;
    Py_INCREF(*type);
    Py_INCREF(*value);
    Py_INCREF(*tb);
    Py_XDECREF(tstate->exc_type);
    Py_XDECREF(tstate->exc_value);
    Py_XDECREF(tstate->exc_traceback);
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    return 0;
bad:
    Py_XDECREF(*type);
    Py_XDECREF(*value);
    Py_XDECREF(*tb);
    return -1;
}

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 int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        if (t->i)
            PyString_InternInPlace(t->p);
        ++t;
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = PyObject_GetAttrString(__pyx_b, "__import__");
    if (!__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_CallFunction(__import__, "OOOO",
        name, global_dict, empty_dict, list);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*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(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
