summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-10-07 19:01:10 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-10-07 19:01:10 (GMT)
commitae0a5ec2a10371adbcdb0df4f3ce536ed6b43840 (patch)
tree149ffe4b553dd12d2222445ca8887692ee1a0ae3 /src/markdown.cpp
parent40f187cc3c6bf8a0599a47557b0c7c60ad1756c9 (diff)
downloadDoxygen-ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840.zip
Doxygen-ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840.tar.gz
Doxygen-ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840.tar.bz2
Use smartpointers to manage the lifetime of Entry objects
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r--src/markdown.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index ce28540..d1a6a63 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -2578,11 +2578,11 @@ QCString markdownFileNameToId(const QCString &fileName)
void MarkdownFileParser::parseInput(const char *fileName,
const char *fileBuf,
- Entry *root,
+ const std::unique_ptr<Entry> &root,
bool /*sameTranslationUnit*/,
QStrList & /*filesInSameTranslationUnit*/)
{
- Entry *current = new Entry;
+ std::unique_ptr<Entry> current = std::make_unique<Entry>();
current->lang = SrcLangExt_Markdown;
current->fileName = fileName;
current->docFile = fileName;
@@ -2630,7 +2630,7 @@ void MarkdownFileParser::parseInput(const char *fileName,
QCString processedDocs = preprocessCommentBlock(docs,fileName,lineNr);
while (parseCommentBlock(
this,
- current,
+ current.get(),
processedDocs,
fileName,
lineNr,
@@ -2644,8 +2644,7 @@ void MarkdownFileParser::parseInput(const char *fileName,
if (needsEntry)
{
QCString docFile = current->docFile;
- root->addSubEntry(current);
- current = new Entry;
+ root->moveToSubEntryAndRefresh(current);
current->lang = SrcLangExt_Markdown;
current->docFile = docFile;
current->docLine = lineNr;
@@ -2653,7 +2652,7 @@ void MarkdownFileParser::parseInput(const char *fileName,
}
if (needsEntry)
{
- root->addSubEntry(current);
+ root->moveToSubEntryAndKeep(current);
}
// restore setting