mercurial/dirs.c
changeset 25093 fe3a72a3e7ca
parent 25092 f41539418b41
child 30104 63e1dca2d6a4
--- a/mercurial/dirs.c	Fri May 08 14:11:00 2015 -0700
+++ b/mercurial/dirs.c	Fri May 08 14:13:12 2015 -0700
@@ -28,12 +28,10 @@
 	PyObject *dict;
 } dirsObject;
 
-static inline Py_ssize_t _finddir(PyObject *path, Py_ssize_t pos)
+static inline Py_ssize_t _finddir(const char *path, Py_ssize_t pos)
 {
-	const char *s = PyString_AS_STRING(path);
-
 	while (pos != -1) {
-		if (s[pos] == '/')
+		if (path[pos] == '/')
 			break;
 		pos -= 1;
 	}
@@ -48,7 +46,7 @@
 	PyObject *key = NULL;
 	int ret = -1;
 
-	while ((pos = _finddir(path, pos - 1)) != -1) {
+	while ((pos = _finddir(cpath, pos - 1)) != -1) {
 		PyObject *val;
 
 		/* It's likely that every prefix already has an entry
@@ -100,7 +98,7 @@
 	PyObject *key = NULL;
 	int ret = -1;
 
-	while ((pos = _finddir(path, pos - 1)) != -1) {
+	while ((pos = _finddir(cpath, pos - 1)) != -1) {
 		PyObject *val;
 
 		key = PyString_FromStringAndSize(cpath, pos);