MCPcopy Create free account
hub / github.com/WinMerge/winmerge / copyEntityTable

Function copyEntityTable

Externals/poco/XML/src/xmlparse.cpp:7744–7805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7742} /* End dtdCopy */
7743
7744static int
7745copyEntityTable(XML_Parser oldParser, HASH_TABLE *newTable,
7746 STRING_POOL *newPool, const HASH_TABLE *oldTable) {
7747 HASH_TABLE_ITER iter;
7748 const XML_Char *cachedOldBase = NULL;
7749 const XML_Char *cachedNewBase = NULL;
7750
7751 hashTableIterInit(&iter, oldTable);
7752
7753 for (;;) {
7754 ENTITY *newE;
7755 const XML_Char *name;
7756 const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
7757 if (! oldE)
7758 break;
7759 name = poolCopyString(newPool, oldE->name);
7760 if (! name)
7761 return 0;
7762 newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY));
7763 if (! newE)
7764 return 0;
7765 if (oldE->systemId) {
7766 const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
7767 if (! tem)
7768 return 0;
7769 newE->systemId = tem;
7770 if (oldE->base) {
7771 if (oldE->base == cachedOldBase)
7772 newE->base = cachedNewBase;
7773 else {
7774 cachedOldBase = oldE->base;
7775 tem = poolCopyString(newPool, cachedOldBase);
7776 if (! tem)
7777 return 0;
7778 cachedNewBase = newE->base = tem;
7779 }
7780 }
7781 if (oldE->publicId) {
7782 tem = poolCopyString(newPool, oldE->publicId);
7783 if (! tem)
7784 return 0;
7785 newE->publicId = tem;
7786 }
7787 } else {
7788 const XML_Char *tem
7789 = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen);
7790 if (! tem)
7791 return 0;
7792 newE->textPtr = tem;
7793 newE->textLen = oldE->textLen;
7794 }
7795 if (oldE->notation) {
7796 const XML_Char *tem = poolCopyString(newPool, oldE->notation);
7797 if (! tem)
7798 return 0;
7799 newE->notation = tem;
7800 }
7801 newE->is_param = oldE->is_param;

Callers 1

dtdCopyFunction · 0.85

Calls 5

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

Tested by

no test coverage detected