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

Function xmlNewTextLen

ThirdParty/libxml2/vtklibxml2/tree.c:2552–2577  ·  view source on GitHub ↗

* xmlNewTextLen: * @content: raw text content (optional) * @len: size of text content * * Use of this function is DISCOURAGED in favor of xmlNewDocTextLen. * * Returns a pointer to the new node object or NULL if a memory * allocation failed. */

Source from the content-addressed store, hash-verified

2550 * allocation failed.
2551 */
2552xmlNodePtr
2553xmlNewTextLen(const xmlChar *content, int len) {
2554 xmlNodePtr cur;
2555
2556 /*
2557 * Allocate a new node and fill the fields.
2558 */
2559 cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
2560 if (cur == NULL)
2561 return(NULL);
2562 memset(cur, 0, sizeof(xmlNode));
2563 cur->type = XML_TEXT_NODE;
2564
2565 cur->name = xmlStringText;
2566 if (content != NULL) {
2567 cur->content = xmlStrndup(content, len);
2568 if (cur->content == NULL) {
2569 xmlFreeNode(cur);
2570 return(NULL);
2571 }
2572 }
2573
2574 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
2575 xmlRegisterNodeDefaultValue(cur);
2576 return(cur);
2577}
2578
2579/**
2580 * xmlNewDocTextLen:

Callers 2

xmlNewDocTextLenFunction · 0.85

Calls 2

xmlStrndupFunction · 0.85
xmlFreeNodeFunction · 0.85

Tested by

no test coverage detected