##// END OF EJS Templates
parsers: change the type signature of hexdigit...
Bryan O'Sullivan -
r16617:4fb16743 default
parent child Browse files
Show More
@@ -13,8 +13,10 b''
13 13
14 14 #include "util.h"
15 15
16 static int hexdigit(char c)
16 static inline int hexdigit(const char *p, Py_ssize_t off)
17 17 {
18 char c = p[off];
19
18 20 if (c >= '0' && c <= '9')
19 21 return c - '0';
20 22 if (c >= 'a' && c <= 'f')
@@ -32,8 +34,8 b' static int hexdigit(char c)'
32 34 static PyObject *unhexlify(const char *str, int len)
33 35 {
34 36 PyObject *ret;
35 const char *c;
36 37 char *d;
38 int i;
37 39
38 40 ret = PyBytes_FromStringAndSize(NULL, len / 2);
39 41
@@ -42,9 +44,9 b' static PyObject *unhexlify(const char *s'
42 44
43 45 d = PyBytes_AsString(ret);
44 46
45 for (c = str; c < str + len;) {
46 int hi = hexdigit(*c++);
47 int lo = hexdigit(*c++);
47 for (i = 0; i < len;) {
48 int hi = hexdigit(str, i++);
49 int lo = hexdigit(str, i++);
48 50 *d++ = (hi << 4) | lo;
49 51 }
50 52
General Comments 0
You need to be logged in to leave comments. Login now