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

Function xmlBuildQName

ThirdParty/libxml2/vtklibxml2/tree.c:167–197  ·  view source on GitHub ↗

* xmlBuildQName: * @ncname: the Name * @prefix: the prefix * @memory: preallocated memory * @len: preallocated memory length * * Builds the QName @prefix:@ncname in @memory if there is enough space * and prefix is not NULL nor empty, otherwise allocate a new string. * If prefix is NULL or empty it returns ncname. * * Returns the new string which must be freed by the caller if differe

Source from the content-addressed store, hash-verified

165 * @memory and @ncname or NULL in case of error
166 */
167xmlChar *
168xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
169 xmlChar *memory, int len) {
170 int lenn, lenp;
171 xmlChar *ret;
172
173 if (ncname == NULL) return(NULL);
174 if (prefix == NULL) return((xmlChar *) ncname);
175
176#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
177 /* Make allocation more likely */
178 if (len > 8)
179 len = 8;
180#endif
181
182 lenn = strlen((char *) ncname);
183 lenp = strlen((char *) prefix);
184
185 if ((memory == NULL) || (len < lenn + lenp + 2)) {
186 ret = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
187 if (ret == NULL)
188 return(NULL);
189 } else {
190 ret = memory;
191 }
192 memcpy(&ret[0], prefix, lenp);
193 ret[lenp] = ':';
194 memcpy(&ret[lenp + 1], ncname, lenn);
195 ret[lenn + lenp + 1] = 0;
196 return(ret);
197}
198
199/**
200 * xmlSplitQName2:

Callers 15

xmlIsIDFunction · 0.85
xmlValidateOneAttributeFunction · 0.85
xmlValidateOneNamespaceFunction · 0.85
xmlValidateOneElementFunction · 0.85
xmlValidateRootFunction · 0.85
xmlXPathNameFunctionFunction · 0.85
xmlSAX2AttributeNsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected