mercurial/parsers.c
changeset 25582 5fa399a0c385
parent 25580 a69983942fb4
child 25583 ce64c9ab19f2
equal deleted inserted replaced
25581:79c75459321e 25582:5fa399a0c385
   203 	default:
   203 	default:
   204 		PyErr_SetString(PyExc_TypeError, "invalid normcasespec");
   204 		PyErr_SetString(PyExc_TypeError, "invalid normcasespec");
   205 		goto quit;
   205 		goto quit;
   206 	}
   206 	}
   207 
   207 
   208 #if PY_VERSION_HEX >= 0x02060000
       
   209 	/* _PyDict_NewPresized expects a minused parameter, but it actually
   208 	/* _PyDict_NewPresized expects a minused parameter, but it actually
   210 	   creates a dictionary that's the nearest power of two bigger than the
   209 	   creates a dictionary that's the nearest power of two bigger than the
   211 	   parameter. For example, with the initial minused = 1000, the
   210 	   parameter. For example, with the initial minused = 1000, the
   212 	   dictionary created has size 1024. Of course in a lot of cases that
   211 	   dictionary created has size 1024. Of course in a lot of cases that
   213 	   can be greater than the maximum load factor Python's dict object
   212 	   can be greater than the maximum load factor Python's dict object
   214 	   expects (= 2/3), so as soon as we cross the threshold we'll resize
   213 	   expects (= 2/3), so as soon as we cross the threshold we'll resize
   215 	   anyway. So create a dictionary that's 3/2 the size. Also add some
   214 	   anyway. So create a dictionary that's 3/2 the size. Also add some
   216 	   more to deal with additions outside this function. */
   215 	   more to deal with additions outside this function. */
   217 	file_foldmap = _PyDict_NewPresized((PyDict_Size(dmap) / 5) * 8);
   216 	file_foldmap = _PyDict_NewPresized((PyDict_Size(dmap) / 5) * 8);
   218 #else
       
   219 	file_foldmap = PyDict_New();
       
   220 #endif
       
   221 
       
   222 	if (file_foldmap == NULL)
   217 	if (file_foldmap == NULL)
   223 		goto quit;
   218 		goto quit;
   224 
   219 
   225 	while (PyDict_Next(dmap, &pos, &k, &v)) {
   220 	while (PyDict_Next(dmap, &pos, &k, &v)) {
   226 		if (!dirstate_tuple_check(v)) {
   221 		if (!dirstate_tuple_check(v)) {