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

Function xmlBufCreateSize

ThirdParty/libxml2/vtklibxml2/buf.c:149–175  ·  view source on GitHub ↗

* xmlBufCreateSize: * @size: initial size of buffer * * routine to create an XML buffer. * returns the new structure. */

Source from the content-addressed store, hash-verified

147 * returns the new structure.
148 */
149xmlBufPtr
150xmlBufCreateSize(size_t size) {
151 xmlBufPtr ret;
152
153 if (size == SIZE_MAX)
154 return(NULL);
155 ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf));
156 if (ret == NULL)
157 return(NULL);
158 ret->use = 0;
159 ret->error = 0;
160 ret->buffer = NULL;
161 ret->alloc = xmlBufferAllocScheme;
162 ret->size = (size ? size + 1 : 0); /* +1 for ending null */
163 UPDATE_COMPAT(ret);
164 if (ret->size){
165 ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
166 if (ret->content == NULL) {
167 xmlFree(ret);
168 return(NULL);
169 }
170 ret->content[0] = 0;
171 } else
172 ret->content = NULL;
173 ret->contentIO = NULL;
174 return(ret);
175}
176
177/**
178 * xmlBufDetach:

Callers 13

xmlTextReaderReadStringFunction · 0.85
xmlNewTextReaderFunction · 0.85
xmlTextReaderConstValueFunction · 0.85
xmlTextReaderSetupFunction · 0.85
xmlNodeGetContentFunction · 0.85
xmlAllocOutputBufferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected