From d532ba07469d60866df60ec4a2f8afe714347d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sat, 27 May 2006 08:54:29 +0000 Subject: [PATCH] Explain why 'consumed' is initialized. --- Modules/_codecsmodule.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c index 26bc2cbeaab..d8d23c4050f 100644 --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -319,12 +319,11 @@ utf_16_decode(PyObject *self, if (!PyArg_ParseTuple(args, "t#|zi:utf_16_decode", &data, &size, &errors, &final)) return NULL; - /* XXX Why is consumed initialized to size? mvl */ if (size < 0) { PyErr_SetString(PyExc_ValueError, "negative argument"); return 0; } - consumed = size; + consumed = size; /* This is overwritten unless final is true. */ decoded = PyUnicode_DecodeUTF16Stateful(data, size, errors, &byteorder, final ? NULL : &consumed); if (decoded == NULL) @@ -348,12 +347,11 @@ utf_16_le_decode(PyObject *self, &data, &size, &errors, &final)) return NULL; - /* XXX Why is consumed initialized to size? mvl */ if (size < 0) { PyErr_SetString(PyExc_ValueError, "negative argument"); return 0; } - consumed = size; + consumed = size; /* This is overwritten unless final is true. */ decoded = PyUnicode_DecodeUTF16Stateful(data, size, errors, &byteorder, final ? NULL : &consumed); if (decoded == NULL) @@ -377,12 +375,11 @@ utf_16_be_decode(PyObject *self, if (!PyArg_ParseTuple(args, "t#|zi:utf_16_be_decode", &data, &size, &errors, &final)) return NULL; - /* XXX Why is consumed initialized to size? mvl */ if (size < 0) { PyErr_SetString(PyExc_ValueError, "negative argument"); return 0; } - consumed = size; + consumed = size; /* This is overwritten unless final is true. */ decoded = PyUnicode_DecodeUTF16Stateful(data, size, errors, &byteorder, final ? NULL : &consumed); if (decoded == NULL) @@ -413,12 +410,11 @@ utf_16_ex_decode(PyObject *self, if (!PyArg_ParseTuple(args, "t#|zii:utf_16_ex_decode", &data, &size, &errors, &byteorder, &final)) return NULL; - /* XXX Why is consumed initialized to size? mvl */ if (size < 0) { PyErr_SetString(PyExc_ValueError, "negative argument"); return 0; } - consumed = size; + consumed = size; /* This is overwritten unless final is true. */ unicode = PyUnicode_DecodeUTF16Stateful(data, size, errors, &byteorder, final ? NULL : &consumed); if (unicode == NULL)