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

Function xmlNewPatParserContext

ThirdParty/libxml2/vtklibxml2/pattern.c:291–319  ·  view source on GitHub ↗

* xmlNewPatParserContext: * @pattern: the pattern context * @dict: the inherited dictionary or NULL * @namespaces: the prefix definitions, array of [URI, prefix] terminated * with [NULL, NULL] or NULL if no namespace is used * * Create a new XML pattern parser context * * Returns the newly allocated xmlPatParserContextPtr or NULL in case of error */

Source from the content-addressed store, hash-verified

289 * Returns the newly allocated xmlPatParserContextPtr or NULL in case of error
290 */
291static xmlPatParserContextPtr
292xmlNewPatParserContext(const xmlChar *pattern, xmlDictPtr dict,
293 const xmlChar **namespaces) {
294 xmlPatParserContextPtr cur;
295
296 if (pattern == NULL)
297 return(NULL);
298
299 cur = (xmlPatParserContextPtr) xmlMalloc(sizeof(xmlPatParserContext));
300 if (cur == NULL) {
301 ERROR(NULL, NULL, NULL,
302 "xmlNewPatParserContext : malloc failed\n");
303 return(NULL);
304 }
305 memset(cur, 0, sizeof(xmlPatParserContext));
306 cur->dict = dict;
307 cur->cur = pattern;
308 cur->base = pattern;
309 if (namespaces != NULL) {
310 int i;
311 for (i = 0;namespaces[2 * i] != NULL;i++)
312 ;
313 cur->nb_namespaces = i;
314 } else {
315 cur->nb_namespaces = 0;
316 }
317 cur->namespaces = namespaces;
318 return(cur);
319}
320
321/**
322 * xmlFreePatParserContext:

Callers 1

xmlPatternCompileSafeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected