##// END OF EJS Templates
parsers: factor out most of asciilower into an internal function...
Siddharth Agarwal -
r24574:e97a00bf default
parent child Browse files
Show More
@@ -93,14 +93,14 b' PyObject *unhexlify(const char *str, int'
93 return ret;
93 return ret;
94 }
94 }
95
95
96 static PyObject *asciilower(PyObject *self, PyObject *args)
96 static inline PyObject *_asciilower(PyObject *str_obj)
97 {
97 {
98 char *str, *newstr;
98 char *str, *newstr;
99 int i, len;
99 Py_ssize_t i, len;
100 PyObject *newobj = NULL;
100 PyObject *newobj = NULL;
101
101
102 if (!PyArg_ParseTuple(args, "s#", &str, &len))
102 str = PyBytes_AS_STRING(str_obj);
103 goto quit;
103 len = PyBytes_GET_SIZE(str_obj);
104
104
105 newobj = PyBytes_FromStringAndSize(NULL, len);
105 newobj = PyBytes_FromStringAndSize(NULL, len);
106 if (!newobj)
106 if (!newobj)
@@ -127,6 +127,14 b' quit:'
127 return NULL;
127 return NULL;
128 }
128 }
129
129
130 static PyObject *asciilower(PyObject *self, PyObject *args)
131 {
132 PyObject *str_obj;
133 if (!PyArg_ParseTuple(args, "O!:asciilower", &PyBytes_Type, &str_obj))
134 return NULL;
135 return _asciilower(str_obj);
136 }
137
130 /*
138 /*
131 * This code assumes that a manifest is stitched together with newline
139 * This code assumes that a manifest is stitched together with newline
132 * ('\n') characters.
140 * ('\n') characters.
General Comments 0
You need to be logged in to leave comments. Login now