| 710 | } |
| 711 | |
| 712 | static void writeMemoryResource(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::MemoryResource &mr) |
| 713 | { |
| 714 | xmlWriter.writeStartElement(mr.type); |
| 715 | for (const CppcheckLibraryData::MemoryResource::Alloc &alloc : mr.alloc) { |
| 716 | if (alloc.isRealloc) { |
| 717 | xmlWriter.writeStartElement("realloc"); |
| 718 | } else { |
| 719 | xmlWriter.writeStartElement("alloc"); |
| 720 | } |
| 721 | xmlWriter.writeAttribute("init", bool_to_string(alloc.init)); |
| 722 | if (alloc.noFail) |
| 723 | xmlWriter.writeAttribute("no-fail", bool_to_string(alloc.noFail)); |
| 724 | if (alloc.arg != -1) { |
| 725 | xmlWriter.writeAttribute("arg", QString("%1").arg(alloc.arg)); |
| 726 | } |
| 727 | if (alloc.isRealloc && alloc.reallocArg != -1) { |
| 728 | xmlWriter.writeAttribute("realloc-arg", QString("%1").arg(alloc.reallocArg)); |
| 729 | } |
| 730 | if (mr.type == "memory" && !alloc.bufferSize.isEmpty()) { |
| 731 | xmlWriter.writeAttribute("buffer-size", alloc.bufferSize); |
| 732 | } |
| 733 | xmlWriter.writeCharacters(alloc.name); |
| 734 | xmlWriter.writeEndElement(); |
| 735 | } |
| 736 | |
| 737 | for (const CppcheckLibraryData::MemoryResource::Dealloc &dealloc : mr.dealloc) { |
| 738 | xmlWriter.writeStartElement("dealloc"); |
| 739 | if (dealloc.arg != -1) { |
| 740 | xmlWriter.writeAttribute("arg", QString("%1").arg(dealloc.arg)); |
| 741 | } |
| 742 | xmlWriter.writeCharacters(dealloc.name); |
| 743 | xmlWriter.writeEndElement(); |
| 744 | } |
| 745 | |
| 746 | for (const QString &use : mr.use) { |
| 747 | xmlWriter.writeTextElement("use", use); |
| 748 | } |
| 749 | xmlWriter.writeEndElement(); |
| 750 | } |
| 751 | |
| 752 | static void writeTypeChecks(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::TypeChecks &typeChecks) |
| 753 | { |
no test coverage detected