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

Function xmlParserNsLookup

ThirdParty/libxml2/vtklibxml2/parser.c:1529–1569  ·  view source on GitHub ↗

* xmlParserNsLookup: * @ctxt: parser context * @prefix: namespace prefix * @bucketPtr: optional bucket (return value) * * Lookup namespace with given prefix. If @bucketPtr is non-NULL, it will * be set to the matching bucket, or the first empty bucket if no match * was found. * * Returns the namespace index on success, INT_MAX if no namespace was * found. */

Source from the content-addressed store, hash-verified

1527 * found.
1528 */
1529static int
1530xmlParserNsLookup(xmlParserCtxtPtr ctxt, const xmlHashedString *prefix,
1531 xmlParserNsBucket **bucketPtr) {
1532 xmlParserNsBucket *bucket, *tombstone;
1533 unsigned index, hashValue;
1534
1535 if (prefix->name == NULL)
1536 return(ctxt->nsdb->defaultNsIndex);
1537
1538 if (ctxt->nsdb->hashSize == 0)
1539 return(INT_MAX);
1540
1541 hashValue = prefix->hashValue;
1542 index = hashValue & (ctxt->nsdb->hashSize - 1);
1543 bucket = &ctxt->nsdb->hash[index];
1544 tombstone = NULL;
1545
1546 while (bucket->hashValue) {
1547 if (bucket->index == INT_MAX) {
1548 if (tombstone == NULL)
1549 tombstone = bucket;
1550 } else if (bucket->hashValue == hashValue) {
1551 if (ctxt->nsTab[bucket->index * 2] == prefix->name) {
1552 if (bucketPtr != NULL)
1553 *bucketPtr = bucket;
1554 return(bucket->index);
1555 }
1556 }
1557
1558 index++;
1559 bucket++;
1560 if (index == ctxt->nsdb->hashSize) {
1561 index = 0;
1562 bucket = ctxt->nsdb->hash;
1563 }
1564 }
1565
1566 if (bucketPtr != NULL)
1567 *bucketPtr = tombstone ? tombstone : bucket;
1568 return(INT_MAX);
1569}
1570
1571/**
1572 * xmlParserNsLookupUri:

Callers 6

xmlParserNsLookupUriFunction · 0.85
xmlParserNsLookupSaxFunction · 0.85
xmlParserNsUpdateSaxFunction · 0.85
xmlParserNsPushFunction · 0.85
xmlParserNsPopFunction · 0.85
xmlParseStartTag2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected