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

Function xmlSBufGrow

ThirdParty/libxml2/vtklibxml2/parser.c:740–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738}
739
740static int
741xmlSBufGrow(xmlSBuf *buf, unsigned len) {
742 xmlChar *mem;
743 unsigned cap;
744
745 if (len >= UINT_MAX / 2 - buf->size) {
746 if (buf->code == XML_ERR_OK)
747 buf->code = XML_ERR_RESOURCE_LIMIT;
748 return(-1);
749 }
750
751 cap = (buf->size + len) * 2;
752 if (cap < 240)
753 cap = 240;
754
755 mem = xmlRealloc(buf->mem, cap);
756 if (mem == NULL) {
757 buf->code = XML_ERR_NO_MEMORY;
758 return(-1);
759 }
760
761 buf->mem = mem;
762 buf->cap = cap;
763
764 return(0);
765}
766
767static void
768xmlSBufAddString(xmlSBuf *buf, const xmlChar *str, unsigned len) {

Callers 2

xmlSBufAddStringFunction · 0.85
xmlSBufAddCharFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected