From c2df86d23477573ef664a20b47b19a42e4a2e6c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 30 Aug 2010 15:02:29 +0200 Subject: Removed QFileInfoPrivate::initFileEngine As it served no real purpose. Instead, the relevant bits were inlined in the constructor that used it and makeAbsolute was adapted to use operator=. Reviewed-by: Thomas Zander --- src/corelib/io/qfileinfo.cpp | 12 ++---------- src/corelib/io/qfileinfo_p.h | 5 ++--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index fe557d0..ccfc9c2 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -47,15 +47,6 @@ QT_BEGIN_NAMESPACE -void QFileInfoPrivate::initFileEngine(const QString &file) -{ - delete fileEngine; - fileEngine = 0; - clear(); - fileEngine = QAbstractFileEngine::create(file); - fileName = file; -} - QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const { if (cache_enabled && !fileNames[(int)name].isNull()) @@ -586,7 +577,8 @@ bool QFileInfo::makeAbsolute() return false; QString absFileName = d_ptr.constData()->getFileName(QAbstractFileEngine::AbsoluteName); // QSharedDataPointer::operator->() will detach. - d_ptr->initFileEngine(absFileName); + + *this = QFileInfo(absFileName); return true; } diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index 138116e..f23ae53 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -79,16 +79,15 @@ public: cachedFlags(0), cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) {} inline QFileInfoPrivate(const QString &file) - : QSharedData(), fileEngine(0), + : QSharedData(), fileEngine(QAbstractFileEngine::create(file)), + fileName(file), cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) { - initFileEngine(file); } inline ~QFileInfoPrivate() { delete fileEngine; } - void initFileEngine(const QString &); inline void clearFlags() const { fileFlags = 0; -- cgit v0.12