MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlCopyPropList

Function xmlCopyPropList

ThirdParty/libxml2/vtklibxml2/tree.c:4140–4163  ·  view source on GitHub ↗

* xmlCopyPropList: * @target: the element where the attributes will be grafted * @cur: the first attribute * * Create a copy of an attribute list. This function sets the * parent pointers of the copied attributes to @target but doesn't * set the attributes on the target element. * * Returns the head of the copied list or NULL if a memory * allocation failed. */

Source from the content-addressed store, hash-verified

4138 * allocation failed.
4139 */
4140xmlAttrPtr
4141xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
4142 xmlAttrPtr ret = NULL;
4143 xmlAttrPtr p = NULL,q;
4144
4145 if ((target != NULL) && (target->type != XML_ELEMENT_NODE))
4146 return(NULL);
4147 while (cur != NULL) {
4148 q = xmlCopyProp(target, cur);
4149 if (q == NULL) {
4150 xmlFreePropList(ret);
4151 return(NULL);
4152 }
4153 if (p == NULL) {
4154 ret = p = q;
4155 } else {
4156 p->next = q;
4157 q->prev = p;
4158 p = q;
4159 }
4160 cur = cur->next;
4161 }
4162 return(ret);
4163}
4164
4165/*
4166 * NOTE about the CopyNode operations !

Callers 1

xmlStaticCopyNodeFunction · 0.85

Calls 2

xmlCopyPropFunction · 0.85
xmlFreePropListFunction · 0.85

Tested by

no test coverage detected