mercurial/parsers.c
changeset 25584 72b2711f12ea
parent 25583 ce64c9ab19f2
child 25810 82d6a35cf432
equal deleted inserted replaced
25583:ce64c9ab19f2 25584:72b2711f12ea
   181 	   dictionary created has size 1024. Of course in a lot of cases that
   181 	   dictionary created has size 1024. Of course in a lot of cases that
   182 	   can be greater than the maximum load factor Python's dict object
   182 	   can be greater than the maximum load factor Python's dict object
   183 	   expects (= 2/3), so as soon as we cross the threshold we'll resize
   183 	   expects (= 2/3), so as soon as we cross the threshold we'll resize
   184 	   anyway. So create a dictionary that's at least 3/2 the size. */
   184 	   anyway. So create a dictionary that's at least 3/2 the size. */
   185 	return _PyDict_NewPresized(((1 + expected_size) / 2) * 3);
   185 	return _PyDict_NewPresized(((1 + expected_size) / 2) * 3);
       
   186 }
       
   187 
       
   188 static PyObject *dict_new_presized(PyObject *self, PyObject *args)
       
   189 {
       
   190 	Py_ssize_t expected_size;
       
   191 
       
   192 	if (!PyArg_ParseTuple(args, "n:make_presized_dict", &expected_size))
       
   193 		return NULL;
       
   194 
       
   195 	return _dict_new_presized(expected_size);
   186 }
   196 }
   187 
   197 
   188 static PyObject *make_file_foldmap(PyObject *self, PyObject *args)
   198 static PyObject *make_file_foldmap(PyObject *self, PyObject *args)
   189 {
   199 {
   190 	PyObject *dmap, *spec_obj, *normcase_fallback;
   200 	PyObject *dmap, *spec_obj, *normcase_fallback;
  2522 	{"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"},
  2532 	{"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"},
  2523 	{"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"},
  2533 	{"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"},
  2524 	{"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},
  2534 	{"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},
  2525 	{"asciilower", asciilower, METH_VARARGS, "lowercase an ASCII string\n"},
  2535 	{"asciilower", asciilower, METH_VARARGS, "lowercase an ASCII string\n"},
  2526 	{"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"},
  2536 	{"asciiupper", asciiupper, METH_VARARGS, "uppercase an ASCII string\n"},
       
  2537 	{"dict_new_presized", dict_new_presized, METH_VARARGS,
       
  2538 	 "construct a dict with an expected size\n"},
  2527 	{"make_file_foldmap", make_file_foldmap, METH_VARARGS,
  2539 	{"make_file_foldmap", make_file_foldmap, METH_VARARGS,
  2528 	 "make file foldmap\n"},
  2540 	 "make file foldmap\n"},
  2529 	{"encodedir", encodedir, METH_VARARGS, "encodedir a path\n"},
  2541 	{"encodedir", encodedir, METH_VARARGS, "encodedir a path\n"},
  2530 	{"pathencode", pathencode, METH_VARARGS, "fncache-encode a path\n"},
  2542 	{"pathencode", pathencode, METH_VARARGS, "fncache-encode a path\n"},
  2531 	{"lowerencode", lowerencode, METH_VARARGS, "lower-encode a path\n"},
  2543 	{"lowerencode", lowerencode, METH_VARARGS, "lower-encode a path\n"},