QLoggingCategory: remove init() and merge with the constructor

Nothing else calls it.

Drive-by initialize the two pointers via NSDMI.

Pick-to: 6.9 6.8
Change-Id: I8c51cf5126aeb8bd6254fffdd21a37526329bbf3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Thiago Macieira 2025-02-10 10:00:01 -08:00 committed by Marc Mutz
parent 16ef3aaa74
commit c7ec043e46
2 changed files with 3 additions and 10 deletions

View File

@ -172,11 +172,6 @@ Q_GLOBAL_STATIC(QLoggingCategory, qtDefaultCategory, qtDefaultCategoryName)
QLoggingCategory::QLoggingCategory(const char *category, QtMsgType enableForLevel)
: d(nullptr),
name(nullptr)
{
init(category, enableForLevel);
}
void QLoggingCategory::init(const char *category, QtMsgType severityLevel)
{
enabled.storeRelaxed(0x01010101); // enabledDebug = enabledWarning = enabledCritical = true;
@ -186,7 +181,7 @@ void QLoggingCategory::init(const char *category, QtMsgType severityLevel)
name = qtDefaultCategoryName;
if (QLoggingRegistry *reg = QLoggingRegistry::instance())
reg->registerCategory(this, severityLevel);
reg->registerCategory(this, enableForLevel);
}
/*!

View File

@ -38,10 +38,8 @@ public:
static void setFilterRules(const QString &rules);
private:
void init(const char *category, QtMsgType severityLevel);
Q_DECL_UNUSED_MEMBER void *d; // reserved for future use
const char *name;
Q_DECL_UNUSED_MEMBER void *d = nullptr; // reserved for future use
const char *name = nullptr;
struct AtomicBools {
QBasicAtomicInteger<bool> enabledDebug;