##// END OF EJS Templates
dirs.c: pass C string, not Python string, to _finddir()...
Martin von Zweigbergk -
r25093:fe3a72a3 default
parent child Browse files
Show More
@@ -28,12 +28,10 b' typedef struct {'
28 PyObject *dict;
28 PyObject *dict;
29 } dirsObject;
29 } dirsObject;
30
30
31 static inline Py_ssize_t _finddir(PyObject *path, Py_ssize_t pos)
31 static inline Py_ssize_t _finddir(const char *path, Py_ssize_t pos)
32 {
32 {
33 const char *s = PyString_AS_STRING(path);
34
35 while (pos != -1) {
33 while (pos != -1) {
36 if (s[pos] == '/')
34 if (path[pos] == '/')
37 break;
35 break;
38 pos -= 1;
36 pos -= 1;
39 }
37 }
@@ -48,7 +46,7 b' static int _addpath(PyObject *dirs, PyOb'
48 PyObject *key = NULL;
46 PyObject *key = NULL;
49 int ret = -1;
47 int ret = -1;
50
48
51 while ((pos = _finddir(path, pos - 1)) != -1) {
49 while ((pos = _finddir(cpath, pos - 1)) != -1) {
52 PyObject *val;
50 PyObject *val;
53
51
54 /* It's likely that every prefix already has an entry
52 /* It's likely that every prefix already has an entry
@@ -100,7 +98,7 b' static int _delpath(PyObject *dirs, PyOb'
100 PyObject *key = NULL;
98 PyObject *key = NULL;
101 int ret = -1;
99 int ret = -1;
102
100
103 while ((pos = _finddir(path, pos - 1)) != -1) {
101 while ((pos = _finddir(cpath, pos - 1)) != -1) {
104 PyObject *val;
102 PyObject *val;
105
103
106 key = PyString_FromStringAndSize(cpath, pos);
104 key = PyString_FromStringAndSize(cpath, pos);
General Comments 0
You need to be logged in to leave comments. Login now