QLockFile: move early out earlier to avoid allocations.
Saves reading two lines and allocating storage for them. Change-Id: I71f6c7019f4c097897945eea52851e4623b75dc2 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
This commit is contained in:
parent
be6c14211e
commit
84330007e1
@ -293,12 +293,12 @@ bool QLockFilePrivate::getLockInfo(qint64 *pid, QString *hostname, QString *appn
|
||||
|
||||
QByteArray pidLine = reader.readLine();
|
||||
pidLine.chop(1);
|
||||
if (pidLine.isEmpty())
|
||||
return false;
|
||||
QByteArray appNameLine = reader.readLine();
|
||||
appNameLine.chop(1);
|
||||
QByteArray hostNameLine = reader.readLine();
|
||||
hostNameLine.chop(1);
|
||||
if (pidLine.isEmpty())
|
||||
return false;
|
||||
|
||||
qint64 thePid = pidLine.toLongLong();
|
||||
if (pid)
|
||||
|
Loading…
Reference in New Issue
Block a user