summaryrefslogtreecommitdiffstats
path: root/Modules/unicodedata.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-01-04 12:59:15 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-01-04 12:59:15 (GMT)
commit0fcab4a3ed5e39769609b60d6179c4c801e45985 (patch)
treefc5592e351ed18a96d7e94aeb2ced52c0ba2fd0d /Modules/unicodedata.c
parent6ab8e8298eba1d52debc53d6e6a38d419bb255c0 (diff)
downloadcpython-0fcab4a3ed5e39769609b60d6179c4c801e45985.zip
cpython-0fcab4a3ed5e39769609b60d6179c4c801e45985.tar.gz
cpython-0fcab4a3ed5e39769609b60d6179c4c801e45985.tar.bz2
Issue #9566: use Py_ssize_t instead of int
Diffstat (limited to 'Modules/unicodedata.c')
-rw-r--r--Modules/unicodedata.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index bd96e36..463be2c 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -403,7 +403,8 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
{
PyUnicodeObject *v;
char decomp[256];
- int code, index, count, i;
+ int code, index, count;
+ size_t i;
unsigned int prefix_index;
Py_UCS4 c;
@@ -450,15 +451,12 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
while (count-- > 0) {
if (i)
decomp[i++] = ' ';
- assert((size_t)i < sizeof(decomp));
+ assert(i < sizeof(decomp));
PyOS_snprintf(decomp + i, sizeof(decomp) - i, "%04X",
decomp_data[++index]);
i += strlen(decomp + i);
}
-
- decomp[i] = '\0';
-
- return PyUnicode_FromString(decomp);
+ return PyUnicode_FromStringAndSize(decomp, i);
}
static void