mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
mark gethostname() success as likely in QHostInfo::localHostName()
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
b5e367cb91
commit
2233f7db2f
1 changed files with 5 additions and 4 deletions
|
@ -255,10 +255,11 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
|
|||
QString QHostInfo::localHostName()
|
||||
{
|
||||
char hostName[HOST_NAME_MAX];
|
||||
if (gethostname(hostName, sizeof(hostName)) == -1)
|
||||
return QString();
|
||||
hostName[sizeof(hostName) - 1] = '\0';
|
||||
return QString::fromLocal8Bit(hostName);
|
||||
if (Q_LIKELY(::gethostname(hostName, sizeof(hostName)) == 0)) {
|
||||
hostName[sizeof(hostName) - 1] = '\0';
|
||||
return QString::fromLocal8Bit(hostName);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QHostInfo::localDomainName()
|
||||
|
|
Loading…
Add table
Reference in a new issue