Utils: Change std::shared_ptr to std::unique_ptr

Its not necessary to use shared_ptr here, unique_ptr is enough.

Change-Id: Ib30dce40054ae8f383674e2e70759e3c30710510
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2025-03-11 08:15:30 +01:00
parent ee6f73048d
commit d8b579d333
3 changed files with 4 additions and 4 deletions

View File

@@ -283,9 +283,9 @@ ElfReader::Result ElfReader::readIt()
return Ok; return Ok;
} }
std::shared_ptr<ElfMapper> ElfReader::readSection(const QByteArray &name) std::unique_ptr<ElfMapper> ElfReader::readSection(const QByteArray &name)
{ {
std::shared_ptr<ElfMapper> mapper; std::unique_ptr<ElfMapper> mapper;
readIt(); readIt();
int i = m_elfData.indexOf(name); int i = m_elfData.indexOf(name);
if (i == -1) if (i == -1)

View File

@@ -140,7 +140,7 @@ public:
enum Result { Ok, NotElf, Corrupt }; enum Result { Ok, NotElf, Corrupt };
ElfData readHeaders(); ElfData readHeaders();
std::shared_ptr<ElfMapper> readSection(const QByteArray &sectionName); std::unique_ptr<ElfMapper> readSection(const QByteArray &sectionName);
QString errorString() const { return m_errorString; } QString errorString() const { return m_errorString; }
QByteArray readCoreName(bool *isCore); QByteArray readCoreName(bool *isCore);

View File

@@ -3130,7 +3130,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
} }
if (globalRegExpSourceMap.isEmpty()) if (globalRegExpSourceMap.isEmpty())
return; return;
if (std::shared_ptr<ElfMapper> mapper = reader.readSection(".debug_str")) { if (std::unique_ptr<ElfMapper> mapper = reader.readSection(".debug_str")) {
const char *str = mapper->start; const char *str = mapper->start;
const char *limit = str + mapper->fdlen; const char *limit = str + mapper->fdlen;
bool found = false; bool found = false;