mercurial/cext/revlog.c
changeset 48821 b0dd39b91e7a
parent 48820 acf9f778e048
child 48852 e633e660158f
equal deleted inserted replaced
48820:acf9f778e048 48821:b0dd39b91e7a
   107 static Py_ssize_t inline_scan(indexObject *self, const char **offsets);
   107 static Py_ssize_t inline_scan(indexObject *self, const char **offsets);
   108 
   108 
   109 static int index_find_node(indexObject *self, const char *node);
   109 static int index_find_node(indexObject *self, const char *node);
   110 
   110 
   111 #if LONG_MAX == 0x7fffffffL
   111 #if LONG_MAX == 0x7fffffffL
   112 static const char *const tuple_format =
   112 static const char *const tuple_format = "Kiiiiiiy#KiBBi";
   113     PY23("Kiiiiiis#KiBBi", "Kiiiiiiy#KiBBi");
       
   114 #else
   113 #else
   115 static const char *const tuple_format =
   114 static const char *const tuple_format = "kiiiiiiy#kiBBi";
   116     PY23("kiiiiiis#kiBBi", "kiiiiiiy#kiBBi");
       
   117 #endif
   115 #endif
   118 
   116 
   119 /* A RevlogNG v1 index entry is 64 bytes long. */
   117 /* A RevlogNG v1 index entry is 64 bytes long. */
   120 static const long v1_entry_size = 64;
   118 static const long v1_entry_size = 64;
   121 
   119 
   718 	Py_ssize_t rev;
   716 	Py_ssize_t rev;
   719 	int sidedata_comp_len;
   717 	int sidedata_comp_len;
   720 	char comp_mode;
   718 	char comp_mode;
   721 	char *data;
   719 	char *data;
   722 #if LONG_MAX == 0x7fffffffL
   720 #if LONG_MAX == 0x7fffffffL
   723 	const char *const sidedata_format = PY23("nKiKB", "nKiKB");
   721 	const char *const sidedata_format = "nKiKB";
   724 #else
   722 #else
   725 	const char *const sidedata_format = PY23("nkikB", "nkikB");
   723 	const char *const sidedata_format = "nkikB";
   726 #endif
   724 #endif
   727 
   725 
   728 	if (self->entry_size == v1_entry_size || self->inlined) {
   726 	if (self->entry_size == v1_entry_size || self->inlined) {
   729 		/*
   727 		/*
   730 		 There is a bug in the transaction handling when going from an
   728 		 There is a bug in the transaction handling when going from an
  2299 	const char *fullnode;
  2297 	const char *fullnode;
  2300 	Py_ssize_t nodelen;
  2298 	Py_ssize_t nodelen;
  2301 	char *node;
  2299 	char *node;
  2302 	int rev, i;
  2300 	int rev, i;
  2303 
  2301 
  2304 	if (!PyArg_ParseTuple(args, PY23("s#", "y#"), &node, &nodelen))
  2302 	if (!PyArg_ParseTuple(args, "y#", &node, &nodelen))
  2305 		return NULL;
  2303 		return NULL;
  2306 
  2304 
  2307 	if (nodelen < 1) {
  2305 	if (nodelen < 1) {
  2308 		PyErr_SetString(PyExc_ValueError, "key too short");
  2306 		PyErr_SetString(PyExc_ValueError, "key too short");
  2309 		return NULL;
  2307 		return NULL;
  3010 		self->entry_size = v2_entry_size;
  3008 		self->entry_size = v2_entry_size;
  3011 	} else if (self->format_version == format_cl2) {
  3009 	} else if (self->format_version == format_cl2) {
  3012 		self->entry_size = cl2_entry_size;
  3010 		self->entry_size = cl2_entry_size;
  3013 	}
  3011 	}
  3014 
  3012 
  3015 	self->nullentry =
  3013 	self->nullentry = Py_BuildValue(
  3016 	    Py_BuildValue(PY23("iiiiiiis#iiBBi", "iiiiiiiy#iiBBi"), 0, 0, 0, -1,
  3014 	    "iiiiiiiy#iiBBi", 0, 0, 0, -1, -1, -1, -1, nullid, self->nodelen, 0,
  3017 	                  -1, -1, -1, nullid, self->nodelen, 0, 0,
  3015 	    0, comp_mode_inline, comp_mode_inline, rank_unknown);
  3018 	                  comp_mode_inline, comp_mode_inline, rank_unknown);
       
  3019 
  3016 
  3020 	if (!self->nullentry)
  3017 	if (!self->nullentry)
  3021 		return -1;
  3018 		return -1;
  3022 	PyObject_GC_UnTrack(self->nullentry);
  3019 	PyObject_GC_UnTrack(self->nullentry);
  3023 
  3020