Lines Matching refs:extra
199 ElementObjectExtra* extra; member
216 self->extra = PyObject_Malloc(sizeof(ElementObjectExtra)); in create_extra()
217 if (!self->extra) { in create_extra()
226 self->extra->attrib = attrib; in create_extra()
228 self->extra->length = 0; in create_extra()
229 self->extra->allocated = STATIC_CHILDREN; in create_extra()
230 self->extra->children = self->extra->_children; in create_extra()
236 dealloc_extra(ElementObjectExtra *extra) in dealloc_extra() argument
240 if (!extra) in dealloc_extra()
243 Py_DECREF(extra->attrib); in dealloc_extra()
245 for (i = 0; i < extra->length; i++) in dealloc_extra()
246 Py_DECREF(extra->children[i]); in dealloc_extra()
248 if (extra->children != extra->_children) in dealloc_extra()
249 PyObject_Free(extra->children); in dealloc_extra()
251 PyObject_Free(extra); in dealloc_extra()
259 if (!self->extra) in clear_extra()
264 myextra = self->extra; in clear_extra()
265 self->extra = NULL; in clear_extra()
281 self->extra = NULL; in create_new_element()
321 e->extra = NULL; in element_new()
434 element_resize(ElementObject* self, Py_ssize_t extra) in element_resize() argument
439 assert(extra >= 0); in element_resize()
443 if (!self->extra) { in element_resize()
448 size = self->extra->length + extra; /* never overflows */ in element_resize()
450 if (size > self->extra->allocated) { in element_resize()
461 if (self->extra->children != self->extra->_children) { in element_resize()
466 children = PyObject_Realloc(self->extra->children, in element_resize()
475 memcpy(children, self->extra->children, in element_resize()
476 self->extra->length * sizeof(PyObject*)); in element_resize()
478 self->extra->children = children; in element_resize()
479 self->extra->allocated = size; in element_resize()
498 self->extra->children[self->extra->length] = element; in element_add_subelement()
500 self->extra->length++; in element_add_subelement()
511 PyObject* res = self->extra->attrib; in element_get_attrib()
519 self->extra->attrib = res; in element_get_attrib()
623 if (self->extra) { in element_gc_traverse()
625 Py_VISIT(self->extra->attrib); in element_gc_traverse()
627 for (i = 0; i < self->extra->length; ++i) in element_gc_traverse()
628 Py_VISIT(self->extra->children[i]); in element_gc_traverse()
719 self->tag, (self->extra) ? self->extra->attrib : Py_None); in _elementtree_Element___copy___impl()
729 assert(!element->extra || !element->extra->length); in _elementtree_Element___copy___impl()
730 if (self->extra) { in _elementtree_Element___copy___impl()
731 if (element_resize(element, self->extra->length) < 0) { in _elementtree_Element___copy___impl()
736 for (i = 0; i < self->extra->length; i++) { in _elementtree_Element___copy___impl()
737 Py_INCREF(self->extra->children[i]); in _elementtree_Element___copy___impl()
738 element->extra->children[i] = self->extra->children[i]; in _elementtree_Element___copy___impl()
741 assert(!element->extra->length); in _elementtree_Element___copy___impl()
742 element->extra->length = self->extra->length; in _elementtree_Element___copy___impl()
775 if (self->extra) { in _elementtree_Element___deepcopy___impl()
776 attrib = deepcopy(self->extra->attrib, memo); in _elementtree_Element___deepcopy___impl()
804 assert(!element->extra || !element->extra->length); in _elementtree_Element___deepcopy___impl()
805 if (self->extra) { in _elementtree_Element___deepcopy___impl()
806 if (element_resize(element, self->extra->length) < 0) in _elementtree_Element___deepcopy___impl()
809 for (i = 0; i < self->extra->length; i++) { in _elementtree_Element___deepcopy___impl()
810 PyObject* child = deepcopy(self->extra->children[i], memo); in _elementtree_Element___deepcopy___impl()
812 element->extra->length = i; in _elementtree_Element___deepcopy___impl()
815 element->extra->children[i] = child; in _elementtree_Element___deepcopy___impl()
818 assert(!element->extra->length); in _elementtree_Element___deepcopy___impl()
819 element->extra->length = self->extra->length; in _elementtree_Element___deepcopy___impl()
899 if (self->extra) { in _elementtree_Element___sizeof___impl()
901 if (self->extra->children != self->extra->_children) in _elementtree_Element___sizeof___impl()
902 result += sizeof(PyObject*) * self->extra->allocated; in _elementtree_Element___sizeof___impl()
933 children = PyList_New(self->extra ? self->extra->length : 0); in _elementtree_Element___getstate___impl()
937 PyObject *child = self->extra->children[i]; in _elementtree_Element___getstate___impl()
943 noattrib = (self->extra == NULL || self->extra->attrib == Py_None); in _elementtree_Element___getstate___impl()
955 PICKLED_ATTRIB, self->extra->attrib, in _elementtree_Element___getstate___impl()
1014 oldextra = self->extra; in element_setstate_from_attributes()
1015 self->extra = NULL; in element_setstate_from_attributes()
1017 assert(!self->extra || !self->extra->length); in element_setstate_from_attributes()
1019 self->extra = oldextra; in element_setstate_from_attributes()
1022 assert(self->extra); in element_setstate_from_attributes()
1023 assert(self->extra->allocated >= nchildren); in element_setstate_from_attributes()
1025 assert(self->extra->attrib == Py_None); in element_setstate_from_attributes()
1026 self->extra->attrib = oldextra->attrib; in element_setstate_from_attributes()
1032 self->extra->children[i] = PyList_GET_ITEM(children, i); in element_setstate_from_attributes()
1033 Py_INCREF(self->extra->children[i]); in element_setstate_from_attributes()
1036 assert(!self->extra->length); in element_setstate_from_attributes()
1037 self->extra->length = nchildren; in element_setstate_from_attributes()
1048 Py_XSETREF(self->extra->attrib, attrib); in element_setstate_from_attributes()
1221 if (!self->extra) in _elementtree_Element_find_impl()
1224 for (i = 0; i < self->extra->length; i++) { in _elementtree_Element_find_impl()
1225 PyObject* item = self->extra->children[i]; in _elementtree_Element_find_impl()
1266 if (!self->extra) { in _elementtree_Element_findtext_impl()
1271 for (i = 0; i < self->extra->length; i++) { in _elementtree_Element_findtext_impl()
1272 PyObject *item = self->extra->children[i]; in _elementtree_Element_findtext_impl()
1325 if (!self->extra) in _elementtree_Element_findall_impl()
1328 for (i = 0; i < self->extra->length; i++) { in _elementtree_Element_findall_impl()
1329 PyObject* item = self->extra->children[i]; in _elementtree_Element_findall_impl()
1382 if (!self->extra || self->extra->attrib == Py_None) in _elementtree_Element_get_impl()
1385 value = PyDict_GetItem(self->extra->attrib, key); in _elementtree_Element_get_impl()
1413 if (!self->extra) in _elementtree_Element_getchildren_impl()
1416 list = PyList_New(self->extra->length); in _elementtree_Element_getchildren_impl()
1420 for (i = 0; i < self->extra->length; i++) { in _elementtree_Element_getchildren_impl()
1421 PyObject* item = self->extra->children[i]; in _elementtree_Element_getchildren_impl()
1500 if (!self->extra || index < 0 || index >= self->extra->length) { in element_getitem()
1508 Py_INCREF(self->extra->children[index]); in element_getitem()
1509 return self->extra->children[index]; in element_getitem()
1528 if (!self->extra) { in _elementtree_Element_insert_impl()
1534 index += self->extra->length; in _elementtree_Element_insert_impl()
1538 if (index > self->extra->length) in _elementtree_Element_insert_impl()
1539 index = self->extra->length; in _elementtree_Element_insert_impl()
1544 for (i = self->extra->length; i > index; i--) in _elementtree_Element_insert_impl()
1545 self->extra->children[i] = self->extra->children[i-1]; in _elementtree_Element_insert_impl()
1548 self->extra->children[index] = subelement; in _elementtree_Element_insert_impl()
1550 self->extra->length++; in _elementtree_Element_insert_impl()
1564 if (!self->extra || self->extra->attrib == Py_None) in _elementtree_Element_items_impl()
1567 return PyDict_Items(self->extra->attrib); in _elementtree_Element_items_impl()
1579 if (!self->extra || self->extra->attrib == Py_None) in _elementtree_Element_keys_impl()
1582 return PyDict_Keys(self->extra->attrib); in _elementtree_Element_keys_impl()
1588 if (!self->extra) in element_length()
1591 return self->extra->length; in element_length()
1637 if (!self->extra) { in _elementtree_Element_remove_impl()
1646 for (i = 0; i < self->extra->length; i++) { in _elementtree_Element_remove_impl()
1647 if (self->extra->children[i] == subelement) in _elementtree_Element_remove_impl()
1649 rc = PyObject_RichCompareBool(self->extra->children[i], subelement, Py_EQ); in _elementtree_Element_remove_impl()
1656 if (i >= self->extra->length) { in _elementtree_Element_remove_impl()
1665 found = self->extra->children[i]; in _elementtree_Element_remove_impl()
1667 self->extra->length--; in _elementtree_Element_remove_impl()
1668 for (; i < self->extra->length; i++) in _elementtree_Element_remove_impl()
1669 self->extra->children[i] = self->extra->children[i+1]; in _elementtree_Element_remove_impl()
1713 if (!self->extra) { in _elementtree_Element_set_impl()
1735 if (!self->extra || index < 0 || index >= self->extra->length) { in element_setitem()
1742 old = self->extra->children[index]; in element_setitem()
1746 self->extra->children[index] = item; in element_setitem()
1748 self->extra->length--; in element_setitem()
1749 for (i = index; i < self->extra->length; i++) in element_setitem()
1750 self->extra->children[i] = self->extra->children[i+1]; in element_setitem()
1769 if (i < 0 && self->extra) in element_subscr()
1770 i += self->extra->length; in element_subscr()
1777 if (!self->extra) in element_subscr()
1783 slicelen = PySlice_AdjustIndices(self->extra->length, &start, &stop, in element_subscr()
1795 PyObject* item = self->extra->children[cur]; in element_subscr()
1821 if (i < 0 && self->extra) in element_ass_subscr()
1822 i += self->extra->length; in element_ass_subscr()
1831 if (!self->extra) { in element_ass_subscr()
1839 slicelen = PySlice_AdjustIndices(self->extra->length, &start, &stop, in element_ass_subscr()
1880 if (cur + step >= (size_t)self->extra->length) { in element_ass_subscr()
1881 num_moved = self->extra->length - cur - 1; in element_ass_subscr()
1884 PyList_SET_ITEM(recycle, i, self->extra->children[cur]); in element_ass_subscr()
1887 self->extra->children + cur - i, in element_ass_subscr()
1888 self->extra->children + cur + 1, in element_ass_subscr()
1894 if (cur < (size_t)self->extra->length) { in element_ass_subscr()
1896 self->extra->children + cur - slicelen, in element_ass_subscr()
1897 self->extra->children + cur, in element_ass_subscr()
1898 (self->extra->length - cur) * sizeof(PyObject *)); in element_ass_subscr()
1901 self->extra->length -= slicelen; in element_ass_subscr()
1949 PyList_SET_ITEM(recycle, i, self->extra->children[cur]); in element_ass_subscr()
1954 for (i = stop; i < self->extra->length; i++) in element_ass_subscr()
1955 self->extra->children[i + newlen - slicelen] = self->extra->children[i]; in element_ass_subscr()
1958 for (i = self->extra->length-1; i >= stop; i--) in element_ass_subscr()
1959 self->extra->children[i + newlen - slicelen] = self->extra->children[i]; in element_ass_subscr()
1967 self->extra->children[cur] = element; in element_ass_subscr()
1970 self->extra->length += newlen - slicelen; in element_ass_subscr()
2014 if (!self->extra) { in element_attrib_getter()
2063 if (!self->extra) { in element_attrib_setter()
2068 Py_SETREF(self->extra->attrib, value); in element_attrib_setter()
2198 ElementObjectExtra *extra; in elementiter_next() local
2200 extra = elem->extra; in elementiter_next()
2201 if (!extra || child_index >= extra->length) { in elementiter_next()
2215 if (!Element_Check(extra->children[child_index])) { in elementiter_next()
2218 Py_TYPE(extra->children[child_index])->tp_name); in elementiter_next()
2221 elem = (ElementObject *)extra->children[child_index]; in elementiter_next()