MCPcopy Create free account
hub / github.com/Kitware/CMake / copyEntityTable

Function copyEntityTable

Utilities/cmexpat/lib/xmlparse.c:7728–7789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7726} /* End dtdCopy */
7727
7728static int
7729copyEntityTable(XML_Parser oldParser, HASH_TABLE *newTable,
7730 STRING_POOL *newPool, const HASH_TABLE *oldTable) {
7731 HASH_TABLE_ITER iter;
7732 const XML_Char *cachedOldBase = NULL;
7733 const XML_Char *cachedNewBase = NULL;
7734
7735 hashTableIterInit(&iter, oldTable);
7736
7737 for (;;) {
7738 ENTITY *newE;
7739 const XML_Char *name;
7740 const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
7741 if (! oldE)
7742 break;
7743 name = poolCopyString(newPool, oldE->name);
7744 if (! name)
7745 return 0;
7746 newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY));
7747 if (! newE)
7748 return 0;
7749 if (oldE->systemId) {
7750 const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
7751 if (! tem)
7752 return 0;
7753 newE->systemId = tem;
7754 if (oldE->base) {
7755 if (oldE->base == cachedOldBase)
7756 newE->base = cachedNewBase;
7757 else {
7758 cachedOldBase = oldE->base;
7759 tem = poolCopyString(newPool, cachedOldBase);
7760 if (! tem)
7761 return 0;
7762 cachedNewBase = newE->base = tem;
7763 }
7764 }
7765 if (oldE->publicId) {
7766 tem = poolCopyString(newPool, oldE->publicId);
7767 if (! tem)
7768 return 0;
7769 newE->publicId = tem;
7770 }
7771 } else {
7772 const XML_Char *tem
7773 = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen);
7774 if (! tem)
7775 return 0;
7776 newE->textPtr = tem;
7777 newE->textLen = oldE->textLen;
7778 }
7779 if (oldE->notation) {
7780 const XML_Char *tem = poolCopyString(newPool, oldE->notation);
7781 if (! tem)
7782 return 0;
7783 newE->notation = tem;
7784 }
7785 newE->is_param = oldE->is_param;

Callers 1

dtdCopyFunction · 0.85

Calls 5

hashTableIterInitFunction · 0.85
hashTableIterNextFunction · 0.85
poolCopyStringFunction · 0.85
poolCopyStringNFunction · 0.85
lookupFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…