Remove method deleteGooList
diff --git a/cpp/poppler-font.cpp b/cpp/poppler-font.cpp
index 4fceb30..6cec12c 100644
--- a/cpp/poppler-font.cpp
+++ b/cpp/poppler-font.cpp
@@ -225,7 +225,10 @@
for (std::size_t i = 0; i < items->size(); ++i) {
fonts[i] = font_info(*new font_info_private((FontInfo *)items->get(i)));
}
- deleteGooList<FontInfo*>(items);
+ for (auto entry : *items) {
+ delete entry;
+ }
+ delete items;
return fonts;
}
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 3064893..8f6c6b7 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -2653,7 +2653,10 @@
if (G_UNLIKELY (iter == nullptr))
return;
- deleteGooList<FontInfo*> (iter->items);
+ for (auto entry : *iter->items) {
+ delete entry;
+ }
+ delete iter->items;
g_slice_free (PopplerFontsIter, iter);
}
diff --git a/goo/GooList.h b/goo/GooList.h
index 172d0d7..3e64811 100644
--- a/goo/GooList.h
+++ b/goo/GooList.h
@@ -54,12 +54,4 @@
const T& get(int i) const { return (*this)[i]; }
};
-template<typename T>
-inline void deleteGooList(GooList<T>* list) {
- for (auto ptr : *list) {
- delete ptr;
- }
- delete list;
-}
-
#endif // GOO_LIST_H
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 29d8037..61e4a07 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -786,7 +786,10 @@
}
}
}
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
}
}
@@ -4117,7 +4120,10 @@
}
if (!font) {
if (daToks) {
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
}
return false;
}
@@ -4425,7 +4431,10 @@
appearBuf->append("EMC\n");
}
if (daToks) {
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
}
if (freeText) {
delete text;
@@ -4498,7 +4507,10 @@
}
if (!font) {
if (daToks) {
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
}
return false;
}
@@ -4514,7 +4526,10 @@
if (fieldChoice->getChoice(i) == nullptr) {
error(errSyntaxError, -1, "Invalid annotation listbox");
if (daToks) {
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
}
return false;
}
@@ -4611,7 +4626,10 @@
}
if (daToks) {
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
}
return true;
diff --git a/poppler/Form.cc b/poppler/Form.cc
index babadbf..95d4889 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -1222,7 +1222,10 @@
if (!p || *p)
fontSize = -1;
}
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
return fontSize;
}
@@ -1233,7 +1236,10 @@
int idx = parseDA(daToks);
if (idx == -1) {
error(errSyntaxError, -1, "FormFieldText:: invalid DA object\n");
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
return;
}
if (defaultAppearance)
@@ -1248,7 +1254,10 @@
defaultAppearance->append(static_cast<GooString*>(daToks->get(i)));
}
}
- deleteGooList<GooString*>(daToks);
+ for (auto entry : *daToks) {
+ delete entry;
+ }
+ delete daToks;
obj.dictSet("DA", Object(defaultAppearance->copy()));
xref->setModifiedObject(&obj, ref);
updateChildrenAppearance();
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 27f6614..00452af 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -2975,7 +2975,10 @@
}
delete alt;
delete func;
- deleteGooList<GfxSeparationColorSpace*>(sepsCS);
+ for (auto entry : *sepsCS) {
+ delete entry;
+ }
+ delete sepsCS;
if (mapping != nullptr)
gfree(mapping);
}
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index f02567b..93f6027 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -254,7 +254,10 @@
}
SysFontList::~SysFontList() {
- deleteGooList<SysFontInfo*>(fonts);
+ for (auto entry : *fonts) {
+ delete entry;
+ }
+ delete fonts;
}
SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exact) {
@@ -553,7 +556,10 @@
delete nameToUnicodeZapfDingbats;
delete nameToUnicodeText;
- deleteGooList<GooString*>(toUnicodeDirs);
+ for (auto entry : *toUnicodeDirs) {
+ delete entry;
+ }
+ delete toUnicodeDirs;
delete sysFonts;
delete textEncoding;
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 5424c06..54c0682 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1279,11 +1279,17 @@
pageBitmap = nullptr;
}
if (segments) {
- deleteGooList<JBIG2Segment*>(segments);
+ for (auto entry : *segments) {
+ delete entry;
+ }
+ delete segments;
segments = nullptr;
}
if (globalSegments) {
- deleteGooList<JBIG2Segment*>(globalSegments);
+ for (auto entry : *globalSegments) {
+ delete entry;
+ }
+ delete globalSegments;
globalSegments = nullptr;
}
dataPtr = dataEnd = nullptr;
diff --git a/poppler/Link.cc b/poppler/Link.cc
index ffe0ebd..d9498ab 100644
--- a/poppler/Link.cc
+++ b/poppler/Link.cc
@@ -53,8 +53,12 @@
}
LinkAction::~LinkAction() {
- if (nextActionList)
- deleteGooList<LinkAction*>(nextActionList);
+ if (nextActionList) {
+ for (auto entry : *nextActionList) {
+ delete entry;
+ }
+ delete nextActionList;
+ }
}
LinkAction *LinkAction::parseDest(const Object *obj) {
@@ -881,13 +885,21 @@
}
LinkOCGState::~LinkOCGState() {
- if (stateList)
- deleteGooList<StateList*>(stateList);
+ if (stateList) {
+ for (auto entry : *stateList) {
+ delete entry;
+ }
+ delete stateList;
+ }
}
LinkOCGState::StateList::~StateList() {
- if (list)
- deleteGooList<Ref*>(list);
+ if (list) {
+ for (auto entry : *list) {
+ delete entry;
+ }
+ delete list;
+ }
}
//------------------------------------------------------------------------
diff --git a/poppler/OptionalContent.cc b/poppler/OptionalContent.cc
index 50f9432..886156e 100644
--- a/poppler/OptionalContent.cc
+++ b/poppler/OptionalContent.cc
@@ -456,7 +456,10 @@
OCDisplayNode::~OCDisplayNode() {
delete name;
if (children) {
- deleteGooList<OCDisplayNode*>(children);
+ for (auto entry : *children) {
+ delete entry;
+ }
+ delete children;
}
}
diff --git a/poppler/Outline.cc b/poppler/Outline.cc
index bc7fe12..20d4f41 100644
--- a/poppler/Outline.cc
+++ b/poppler/Outline.cc
@@ -50,7 +50,10 @@
Outline::~Outline() {
if (items) {
- deleteGooList<OutlineItem*>(items);
+ for (auto entry : *items) {
+ delete entry;
+ }
+ delete items;
}
}
@@ -153,7 +156,10 @@
void OutlineItem::close() {
if (kids) {
- deleteGooList<OutlineItem*>(kids);
+ for (auto entry : *kids) {
+ delete entry;
+ }
+ delete kids;
kids = nullptr;
}
}
diff --git a/poppler/PDFDocFactory.cc b/poppler/PDFDocFactory.cc
index 9f6c275..33bba59 100644
--- a/poppler/PDFDocFactory.cc
+++ b/poppler/PDFDocFactory.cc
@@ -46,7 +46,10 @@
PDFDocFactory::~PDFDocFactory()
{
if (builders) {
- deleteGooList<PDFDocBuilder*>(builders);
+ for (auto entry : *builders) {
+ delete entry;
+ }
+ delete builders;
}
}
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 9c51b6f..8f10be7 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1478,7 +1478,10 @@
#endif
}
if (paperSizes) {
- deleteGooList<PSOutPaperSize*>(paperSizes);
+ for (auto entry : *paperSizes) {
+ delete entry;
+ }
+ delete paperSizes;
}
if (embFontList) {
delete embFontList;
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 616bfdc..151437f 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -2391,8 +2391,14 @@
}
}
delete fonts;
- deleteGooList<TextUnderline*>(underlines);
- deleteGooList<TextLink*>(links);
+ for (auto entry : *underlines) {
+ delete entry;
+ }
+ delete underlines;
+ for (auto entry : *links) {
+ delete entry;
+ }
+ delete links;
}
void TextPage::incRefCnt() {
@@ -2446,9 +2452,18 @@
}
gfree(blocks);
}
- deleteGooList<TextFontInfo*>(fonts);
- deleteGooList<TextUnderline*>(underlines);
- deleteGooList<TextLink*>(links);
+ for (auto entry : *fonts) {
+ delete entry;
+ }
+ delete fonts;
+ for (auto entry : *underlines) {
+ delete entry;
+ }
+ delete underlines;
+ for (auto entry : *links) {
+ delete entry;
+ }
+ delete links;
curWord = nullptr;
charPos = 0;
@@ -4440,8 +4455,12 @@
TextSelectionDumper::~TextSelectionDumper()
{
- for (int i = 0; i < nLines; i++)
- deleteGooList<TextWordSelection*>(lines[i]);
+ for (int i = 0; i < nLines; i++) {
+ for (auto entry : *(lines[i])) {
+ delete entry;
+ }
+ delete lines[i];
+ }
gfree(lines);
}
@@ -4677,7 +4696,10 @@
TextSelectionPainter::~TextSelectionPainter()
{
- deleteGooList<TextWordSelection*>(selectionList);
+ for (auto entry : *selectionList) {
+ delete entry;
+ }
+ delete selectionList;
delete state;
}
diff --git a/qt5/src/poppler-fontinfo.cc b/qt5/src/poppler-fontinfo.cc
index a1c0dd8..ab2206c 100644
--- a/qt5/src/poppler-fontinfo.cc
+++ b/qt5/src/poppler-fontinfo.cc
@@ -134,7 +134,11 @@
for ( std::size_t i = 0; i < items->size(); ++i ) {
fonts.append( FontInfo( FontInfoData( ( ::FontInfo* )items->get( i ) ) ) );
}
- deleteGooList<::FontInfo*>( items );
+ for ( auto entry : *items ) {
+ delete entry;
+ }
+ delete items;
+
return fonts;
}
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index 8b260a0..d4411a0 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -159,7 +159,10 @@
}
}
gfree(alpha);
- deleteGooList<GfxSeparationColorSpace*>(separationList);
+ for (auto entry : *separationList) {
+ delete entry;
+ }
+ delete separationList;
}
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 7656f19..3e894d0 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -292,7 +292,10 @@
delete DocName;
delete fonts;
delete links;
- deleteGooList<HtmlImage*>(imgList);
+ for (auto entry : *imgList) {
+ delete entry;
+ }
+ delete imgList;
}
void HtmlPage::updateFont(GfxState *state) {
@@ -1199,7 +1202,10 @@
delete Docname;
delete docTitle;
- deleteGooList<HtmlMetaVar*>(glMetaVars);
+ for (auto entry : *glMetaVars) {
+ delete entry;
+ }
+ delete glMetaVars;
if (fContentsFrame){
fputs("</body>\n</html>\n",fContentsFrame);