Skip to content

Commit b01f080

Browse files
Inline QPropertyBindingDataPointer
The only non-inline function of that class was observerCount() which would use two of the inline functions defined in the header file, so we can safely inline observerCount() and make the whole class contain only inline methods Consequently, inline class doesn't have to be exported in Windows Change-Id: I41d144d9a50420bbc0091992b36cc36ac2567704 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
1 parent 7cb2159 commit b01f080

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/corelib/kernel/qproperty.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,6 @@ QPropertyBindingData::NotificationResult QPropertyBindingData::notifyObserver_he
608608
return Evaluated;
609609
}
610610

611-
int QPropertyBindingDataPointer::observerCount() const
612-
{
613-
int count = 0;
614-
for (auto observer = firstObserver(); observer; observer = observer.nextObserver())
615-
++count;
616-
return count;
617-
}
618611

619612
QPropertyObserver::QPropertyObserver(ChangeHandler changeHandler)
620613
{

src/corelib/kernel/qproperty_p.h

+12-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace QtPrivate {
6868
// we need to allow the compiler to inline where it makes sense.
6969

7070
// This is a helper "namespace"
71-
struct Q_AUTOTEST_EXPORT QPropertyBindingDataPointer
71+
struct QPropertyBindingDataPointer
7272
{
7373
const QtPrivate::QPropertyBindingData *ptr = nullptr;
7474

@@ -85,10 +85,10 @@ struct Q_AUTOTEST_EXPORT QPropertyBindingDataPointer
8585
}
8686
static void fixupAfterMove(QtPrivate::QPropertyBindingData *ptr);
8787
void Q_ALWAYS_INLINE addObserver(QPropertyObserver *observer);
88-
void setFirstObserver(QPropertyObserver *observer);
89-
QPropertyObserverPointer firstObserver() const;
88+
inline void setFirstObserver(QPropertyObserver *observer);
89+
inline QPropertyObserverPointer firstObserver() const;
9090

91-
int observerCount() const;
91+
inline int observerCount() const;
9292

9393
template <typename T>
9494
static QPropertyBindingDataPointer get(QProperty<T> &property)
@@ -442,6 +442,14 @@ inline QPropertyObserverPointer QPropertyBindingDataPointer::firstObserver() con
442442
return { reinterpret_cast<QPropertyObserver *>(ptr->d()) };
443443
}
444444

445+
inline int QPropertyBindingDataPointer::observerCount() const
446+
{
447+
int count = 0;
448+
for (auto observer = firstObserver(); observer; observer = observer.nextObserver())
449+
++count;
450+
return count;
451+
}
452+
445453
namespace QtPrivate {
446454
Q_CORE_EXPORT bool isPropertyInBindingWrapper(const QUntypedPropertyData *property);
447455
void Q_CORE_EXPORT initBindingStatusThreadId();

0 commit comments

Comments
 (0)