Issue #8930: fix some C code indentation

This commit is contained in:
Antoine Pitrou 2010-06-09 16:24:00 +00:00
parent ae1bb9a00c
commit 619f16e194
3 changed files with 279 additions and 279 deletions

View file

@ -176,28 +176,28 @@ static PyObject *
escape_encode(PyObject *self,
PyObject *args)
{
PyObject *str;
const char *errors = NULL;
char *buf;
Py_ssize_t consumed, len;
PyObject *str;
const char *errors = NULL;
char *buf;
Py_ssize_t consumed, len;
if (!PyArg_ParseTuple(args, "S|z:escape_encode",
&str, &errors))
return NULL;
if (!PyArg_ParseTuple(args, "S|z:escape_encode",
&str, &errors))
return NULL;
consumed = PyString_GET_SIZE(str);
str = PyString_Repr(str, 0);
if (!str)
return NULL;
consumed = PyString_GET_SIZE(str);
str = PyString_Repr(str, 0);
if (!str)
return NULL;
/* The string will be quoted. Unquote, similar to unicode-escape. */
buf = PyString_AS_STRING (str);
len = PyString_GET_SIZE (str);
memmove(buf, buf+1, len-2);
if (_PyString_Resize(&str, len-2) < 0)
return NULL;
/* The string will be quoted. Unquote, similar to unicode-escape. */
buf = PyString_AS_STRING (str);
len = PyString_GET_SIZE (str);
memmove(buf, buf+1, len-2);
if (_PyString_Resize(&str, len-2) < 0)
return NULL;
return codec_tuple(str, consumed);
return codec_tuple(str, consumed);
}
#ifdef Py_USING_UNICODE
@ -233,7 +233,7 @@ static PyObject *
utf_7_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int final = 0;
Py_ssize_t consumed;
@ -246,7 +246,7 @@ utf_7_decode(PyObject *self,
decoded = PyUnicode_DecodeUTF7Stateful(pbuf.buf, pbuf.len, errors,
final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -256,7 +256,7 @@ static PyObject *
utf_8_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int final = 0;
Py_ssize_t consumed;
@ -269,7 +269,7 @@ utf_8_decode(PyObject *self,
decoded = PyUnicode_DecodeUTF8Stateful(pbuf.buf, pbuf.len, errors,
final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -279,7 +279,7 @@ static PyObject *
utf_16_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = 0;
int final = 0;
@ -292,7 +292,7 @@ utf_16_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -302,7 +302,7 @@ static PyObject *
utf_16_le_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = -1;
int final = 0;
@ -316,7 +316,7 @@ utf_16_le_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -326,7 +326,7 @@ static PyObject *
utf_16_be_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = 1;
int final = 0;
@ -340,7 +340,7 @@ utf_16_be_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -358,7 +358,7 @@ static PyObject *
utf_16_ex_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = 0;
PyObject *unicode, *tuple;
@ -371,7 +371,7 @@ utf_16_ex_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
unicode = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (unicode == NULL)
return NULL;
tuple = Py_BuildValue("Oni", unicode, consumed, byteorder);
@ -383,7 +383,7 @@ static PyObject *
utf_32_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = 0;
int final = 0;
@ -396,7 +396,7 @@ utf_32_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -406,7 +406,7 @@ static PyObject *
utf_32_le_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = -1;
int final = 0;
@ -419,7 +419,7 @@ utf_32_le_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -429,7 +429,7 @@ static PyObject *
utf_32_be_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = 1;
int final = 0;
@ -442,7 +442,7 @@ utf_32_be_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);
@ -460,7 +460,7 @@ static PyObject *
utf_32_ex_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int byteorder = 0;
PyObject *unicode, *tuple;
@ -473,7 +473,7 @@ utf_32_ex_decode(PyObject *self,
consumed = pbuf.len; /* This is overwritten unless final is true. */
unicode = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
&byteorder, final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (unicode == NULL)
return NULL;
tuple = Py_BuildValue("Oni", unicode, consumed, byteorder);
@ -485,7 +485,7 @@ static PyObject *
unicode_escape_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
PyObject *unicode;
@ -493,68 +493,68 @@ unicode_escape_decode(PyObject *self,
&pbuf, &errors))
return NULL;
unicode = PyUnicode_DecodeUnicodeEscape(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
unicode = PyUnicode_DecodeUnicodeEscape(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
}
static PyObject *
raw_unicode_escape_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
PyObject *unicode;
PyObject *unicode;
if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode",
&pbuf, &errors))
return NULL;
unicode = PyUnicode_DecodeRawUnicodeEscape(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
unicode = PyUnicode_DecodeRawUnicodeEscape(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
}
static PyObject *
latin_1_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
PyObject *unicode;
Py_buffer pbuf;
PyObject *unicode;
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "s*|z:latin_1_decode",
&pbuf, &errors))
return NULL;
unicode = PyUnicode_DecodeLatin1(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
unicode = PyUnicode_DecodeLatin1(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
}
static PyObject *
ascii_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
PyObject *unicode;
Py_buffer pbuf;
PyObject *unicode;
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "s*|z:ascii_decode",
&pbuf, &errors))
return NULL;
unicode = PyUnicode_DecodeASCII(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
unicode = PyUnicode_DecodeASCII(pbuf.buf, pbuf.len, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
}
static PyObject *
charmap_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
PyObject *unicode;
Py_buffer pbuf;
PyObject *unicode;
const char *errors = NULL;
PyObject *mapping = NULL;
@ -564,9 +564,9 @@ charmap_decode(PyObject *self,
if (mapping == Py_None)
mapping = NULL;
unicode = PyUnicode_DecodeCharmap(pbuf.buf, pbuf.len, mapping, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
unicode = PyUnicode_DecodeCharmap(pbuf.buf, pbuf.len, mapping, errors);
PyBuffer_Release(&pbuf);
return codec_tuple(unicode, pbuf.len);
}
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
@ -575,7 +575,7 @@ static PyObject *
mbcs_decode(PyObject *self,
PyObject *args)
{
Py_buffer pbuf;
Py_buffer pbuf;
const char *errors = NULL;
int final = 0;
Py_ssize_t consumed;
@ -588,7 +588,7 @@ mbcs_decode(PyObject *self,
decoded = PyUnicode_DecodeMBCSStateful(pbuf.buf, pbuf.len, errors,
final ? NULL : &consumed);
PyBuffer_Release(&pbuf);
PyBuffer_Release(&pbuf);
if (decoded == NULL)
return NULL;
return codec_tuple(decoded, consumed);