diff --git a/core_pe/modules/cache/cache.c b/core_pe/modules/cache/cache.c index 240a1f5d..a808b000 100644 --- a/core_pe/modules/cache/cache.c +++ b/core_pe/modules/cache/cache.c @@ -2,6 +2,7 @@ * Created On: 2010-01-30 * Copyright 2010 Hardcoded Software (http://www.hardcoded.net) */ +#define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" #include "stdio.h" @@ -11,7 +12,7 @@ * a char, which would in turn require me to buffer my chars around, * making the whole process slower. */ -static inline long +static long xchar_to_long(char c) { if ((c >= 48) && (c <= 57)) { /* 0-9 */ @@ -30,53 +31,45 @@ static PyObject* cache_string_to_colors(PyObject *self, PyObject *args) { char *s; - Py_ssize_t char_count; + Py_ssize_t char_count, color_count, i; PyObject *result; - int i; - if (!PyArg_ParseTuple(args, "s#", &s, &char_count)) { return NULL; } - result = PyList_New(0); + color_count = (char_count / 6); + result = PyList_New(color_count); if (result == NULL) { return NULL; } - char_count = (char_count / 6) * 6; - for (i=0; i