##// END OF EJS Templates
parsers: make _asciilower a generic _asciitransform function...
Siddharth Agarwal -
r24576:fe173106 default
parent child Browse files
Show More
@@ -93,7 +93,8 PyObject *unhexlify(const char *str, int
93 return ret;
93 return ret;
94 }
94 }
95
95
96 static inline PyObject *_asciilower(PyObject *str_obj)
96 static inline PyObject *_asciitransform(PyObject *str_obj,
97 const char table[128])
97 {
98 {
98 char *str, *newstr;
99 char *str, *newstr;
99 Py_ssize_t i, len;
100 Py_ssize_t i, len;
@@ -119,7 +120,7 static inline PyObject *_asciilower(PyOb
119 Py_XDECREF(err);
120 Py_XDECREF(err);
120 goto quit;
121 goto quit;
121 }
122 }
122 newstr[i] = lowertable[(unsigned char)c];
123 newstr[i] = table[(unsigned char)c];
123 }
124 }
124
125
125 ret = newobj;
126 ret = newobj;
@@ -134,7 +135,7 static PyObject *asciilower(PyObject *se
134 PyObject *str_obj;
135 PyObject *str_obj;
135 if (!PyArg_ParseTuple(args, "O!:asciilower", &PyBytes_Type, &str_obj))
136 if (!PyArg_ParseTuple(args, "O!:asciilower", &PyBytes_Type, &str_obj))
136 return NULL;
137 return NULL;
137 return _asciilower(str_obj);
138 return _asciitransform(str_obj, lowertable);
138 }
139 }
139
140
140 /*
141 /*
General Comments 0
You need to be logged in to leave comments. Login now