mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
_elementtree.c: remove trailing spaces
This commit is contained in:
parent
7878020035
commit
bfc7bf06a6
1 changed files with 19 additions and 19 deletions
|
|
@ -226,7 +226,7 @@ typedef struct {
|
||||||
PyObject* *children;
|
PyObject* *children;
|
||||||
|
|
||||||
PyObject* _children[STATIC_CHILDREN];
|
PyObject* _children[STATIC_CHILDREN];
|
||||||
|
|
||||||
} ElementObjectExtra;
|
} ElementObjectExtra;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -354,14 +354,14 @@ element_resize(ElementObject* self, int extra)
|
||||||
/* use Python 2.4's list growth strategy */
|
/* use Python 2.4's list growth strategy */
|
||||||
size = (size >> 3) + (size < 9 ? 3 : 6) + size;
|
size = (size >> 3) + (size < 9 ? 3 : 6) + size;
|
||||||
/* Coverity CID #182 size_error: Allocating 1 bytes to pointer "children"
|
/* Coverity CID #182 size_error: Allocating 1 bytes to pointer "children"
|
||||||
* which needs at least 4 bytes.
|
* which needs at least 4 bytes.
|
||||||
* Although it's a false alarm always assume at least one child to
|
* Although it's a false alarm always assume at least one child to
|
||||||
* be safe.
|
* be safe.
|
||||||
*/
|
*/
|
||||||
size = size ? size : 1;
|
size = size ? size : 1;
|
||||||
if (self->extra->children != self->extra->_children) {
|
if (self->extra->children != self->extra->_children) {
|
||||||
/* Coverity CID #182 size_error: Allocating 1 bytes to pointer
|
/* Coverity CID #182 size_error: Allocating 1 bytes to pointer
|
||||||
* "children", which needs at least 4 bytes. Although it's a
|
* "children", which needs at least 4 bytes. Although it's a
|
||||||
* false alarm always assume at least one child to be safe.
|
* false alarm always assume at least one child to be safe.
|
||||||
*/
|
*/
|
||||||
children = PyObject_Realloc(self->extra->children,
|
children = PyObject_Realloc(self->extra->children,
|
||||||
|
|
@ -606,7 +606,7 @@ element_copy(ElementObject* self, PyObject* args)
|
||||||
Py_INCREF(JOIN_OBJ(element->tail));
|
Py_INCREF(JOIN_OBJ(element->tail));
|
||||||
|
|
||||||
if (self->extra) {
|
if (self->extra) {
|
||||||
|
|
||||||
if (element_resize(element, self->extra->length) < 0) {
|
if (element_resize(element, self->extra->length) < 0) {
|
||||||
Py_DECREF(element);
|
Py_DECREF(element);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -618,7 +618,7 @@ element_copy(ElementObject* self, PyObject* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
element->extra->length = self->extra->length;
|
element->extra->length = self->extra->length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (PyObject*) element;
|
return (PyObject*) element;
|
||||||
|
|
@ -661,7 +661,7 @@ element_deepcopy(ElementObject* self, PyObject* args)
|
||||||
|
|
||||||
if (!element)
|
if (!element)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
text = deepcopy(JOIN_OBJ(self->text), memo);
|
text = deepcopy(JOIN_OBJ(self->text), memo);
|
||||||
if (!text)
|
if (!text)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
@ -675,7 +675,7 @@ element_deepcopy(ElementObject* self, PyObject* args)
|
||||||
element->tail = JOIN_SET(tail, JOIN_GET(self->tail));
|
element->tail = JOIN_SET(tail, JOIN_GET(self->tail));
|
||||||
|
|
||||||
if (self->extra) {
|
if (self->extra) {
|
||||||
|
|
||||||
if (element_resize(element, self->extra->length) < 0)
|
if (element_resize(element, self->extra->length) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
@ -689,7 +689,7 @@ element_deepcopy(ElementObject* self, PyObject* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
element->extra->length = self->extra->length;
|
element->extra->length = self->extra->length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add object to memo dictionary (so deepcopy won't visit it again) */
|
/* add object to memo dictionary (so deepcopy won't visit it again) */
|
||||||
|
|
@ -800,7 +800,7 @@ element_find(ElementObject* self, PyObject* args)
|
||||||
|
|
||||||
if (!self->extra)
|
if (!self->extra)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
for (i = 0; i < self->extra->length; i++) {
|
for (i = 0; i < self->extra->length; i++) {
|
||||||
PyObject* item = self->extra->children[i];
|
PyObject* item = self->extra->children[i];
|
||||||
if (Element_CheckExact(item) &&
|
if (Element_CheckExact(item) &&
|
||||||
|
|
@ -953,7 +953,7 @@ static PyObject*
|
||||||
element_iter(ElementObject* self, PyObject* args)
|
element_iter(ElementObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
PyObject* result;
|
PyObject* result;
|
||||||
|
|
||||||
PyObject* tag = Py_None;
|
PyObject* tag = Py_None;
|
||||||
if (!PyArg_ParseTuple(args, "|O:iter", &tag))
|
if (!PyArg_ParseTuple(args, "|O:iter", &tag))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -985,7 +985,7 @@ static PyObject*
|
||||||
element_itertext(ElementObject* self, PyObject* args)
|
element_itertext(ElementObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
PyObject* result;
|
PyObject* result;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, ":itertext"))
|
if (!PyArg_ParseTuple(args, ":itertext"))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -1483,7 +1483,7 @@ element_getattro(ElementObject* self, PyObject* nameobj)
|
||||||
|
|
||||||
if (PyUnicode_Check(nameobj))
|
if (PyUnicode_Check(nameobj))
|
||||||
name = _PyUnicode_AsString(nameobj);
|
name = _PyUnicode_AsString(nameobj);
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -2113,7 +2113,7 @@ makeuniversal(XMLParserObject* self, const char* string)
|
||||||
Py_INCREF(key);
|
Py_INCREF(key);
|
||||||
tag = key;
|
tag = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decode universal name */
|
/* decode universal name */
|
||||||
p = PyBytes_AS_STRING(tag);
|
p = PyBytes_AS_STRING(tag);
|
||||||
value = PyUnicode_DecodeUTF8(p, size, "strict");
|
value = PyUnicode_DecodeUTF8(p, size, "strict");
|
||||||
|
|
@ -2407,7 +2407,7 @@ expat_unknown_encoding_handler(XMLParserObject *self, const XML_Char *name,
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
s[i] = i;
|
s[i] = i;
|
||||||
|
|
||||||
u = PyUnicode_Decode((char*) s, 256, name, "replace");
|
u = PyUnicode_Decode((char*) s, 256, name, "replace");
|
||||||
if (!u)
|
if (!u)
|
||||||
return XML_STATUS_ERROR;
|
return XML_STATUS_ERROR;
|
||||||
|
|
@ -2466,7 +2466,7 @@ xmlparser(PyObject* self_, PyObject* args, PyObject* kw)
|
||||||
PyObject_Del(self);
|
PyObject_Del(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->names = PyDict_New();
|
self->names = PyDict_New();
|
||||||
if (!self->names) {
|
if (!self->names) {
|
||||||
PyObject_Del(self->entity);
|
PyObject_Del(self->entity);
|
||||||
|
|
@ -2645,7 +2645,7 @@ xmlparser_parse(XMLParserObject* self, PyObject* args)
|
||||||
reader = PyObject_GetAttrString(fileobj, "read");
|
reader = PyObject_GetAttrString(fileobj, "read");
|
||||||
if (!reader)
|
if (!reader)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* read from open file object */
|
/* read from open file object */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
|
|
@ -2796,7 +2796,7 @@ static PyMethodDef xmlparser_methods[] = {
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
xmlparser_getattro(XMLParserObject* self, PyObject* nameobj)
|
xmlparser_getattro(XMLParserObject* self, PyObject* nameobj)
|
||||||
{
|
{
|
||||||
if (PyUnicode_Check(nameobj)) {
|
if (PyUnicode_Check(nameobj)) {
|
||||||
|
|
@ -2957,7 +2957,7 @@ PyInit__elementtree(void)
|
||||||
" break\n"
|
" break\n"
|
||||||
" parser.feed(data)\n"
|
" parser.feed(data)\n"
|
||||||
" self._root = parser.close()\n"
|
" self._root = parser.close()\n"
|
||||||
" else:\n"
|
" else:\n"
|
||||||
" parser = cElementTree.XMLParser()\n"
|
" parser = cElementTree.XMLParser()\n"
|
||||||
" self._root = parser._parse(source)\n"
|
" self._root = parser._parse(source)\n"
|
||||||
" return self._root\n"
|
" return self._root\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue