QLockFile/Linux: skip QFileInfo if we're just doing string manipulation

Avoids a lot of overhead. Could be even simpler, but we don't need to
duplicate QFileSystemEntry.

Pick-to: 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16beda971e4b2ae7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
bb10
Thiago Macieira 2021-12-08 10:20:56 -08:00
parent 154d87f23f
commit 799660d679
1 changed files with 2 additions and 1 deletions

View File

@ -52,6 +52,7 @@
#include "private/qcore_unix_p.h" // qt_safe_open
#include "private/qabstractfileengine_p.h"
#include "private/qfilesystementry_p.h"
#include "private/qtemporaryfile_p.h"
#if !defined(Q_OS_INTEGRITY)
@ -244,7 +245,7 @@ QString QLockFilePrivate::processNameByPid(qint64 pid)
if (buf.endsWith(deleted))
buf.chop(strlen(deleted));
return QFileInfo(QFile::decodeName(buf)).fileName();
return QFileSystemEntry(buf, QFileSystemEntry::FromNativePath()).fileName();
#elif defined(Q_OS_HAIKU)
thread_info info;
if (get_thread_info(pid, &info) != B_OK)