mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
assume const methods are thread-safe and avoid locking where possible
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
2dae6f2ab7
commit
b24596c151
1 changed files with 8 additions and 4 deletions
|
@ -2063,8 +2063,10 @@ void QUrl::setScheme(const QString &scheme)
|
|||
QString QUrl::scheme() const
|
||||
{
|
||||
if (!d) return QString();
|
||||
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
|
||||
QMutexLocker lock(&d->mutex);
|
||||
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
|
||||
d->parse();
|
||||
}
|
||||
|
||||
return d->scheme;
|
||||
}
|
||||
|
@ -2416,8 +2418,10 @@ void QUrl::setPort(int port)
|
|||
int QUrl::port(int defaultPort) const
|
||||
{
|
||||
if (!d) return defaultPort;
|
||||
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) {
|
||||
QMutexLocker lock(&d->mutex);
|
||||
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
|
||||
d->parse();
|
||||
}
|
||||
return d->port == -1 ? defaultPort : d->port;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue