From f8cb8f242817c94a3f368b01243a88918d211f1e Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Tue, 26 May 2009 09:50:16 +1000 Subject: Protect dump function by ifdef. Use the same pattern for protecting the dump function as qmap.h and qhash.h employ. --- src/corelib/tools/qcontiguouscache.cpp | 4 ++++ src/corelib/tools/qcontiguouscache.h | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp index 7db3a5a..996ac18 100644 --- a/src/corelib/tools/qcontiguouscache.cpp +++ b/src/corelib/tools/qcontiguouscache.cpp @@ -40,10 +40,13 @@ ****************************************************************************/ #include "qcontiguouscache.h" +#ifdef QT_QCONTIGUOUSCACHE_DEBUG #include +#endif QT_BEGIN_NAMESPACE +#ifdef QT_QCONTIGUOUSCACHE_DEBUG void QContiguousCacheData::dump() const { qDebug() << "capacity:" << alloc; @@ -51,6 +54,7 @@ void QContiguousCacheData::dump() const qDebug() << "start:" << start; qDebug() << "offset:" << offset; } +#endif /*! \class QContiguousCache \brief The QContiguousCache class is a template class that provides a contiguous cache. diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 5cd1582..2437f63 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -49,8 +49,10 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +#undef QT_QCONTIGUOUSCACHE_DEBUG QT_MODULE(Core) + struct Q_CORE_EXPORT QContiguousCacheData { QBasicAtomicInt ref; @@ -60,7 +62,9 @@ struct Q_CORE_EXPORT QContiguousCacheData int offset; uint sharable : 1; +#ifdef QT_QCONTIGUOUSCACHE_DEBUG void dump() const; +#endif }; template @@ -131,8 +135,10 @@ public: { return d->offset >= 0 && d->offset < INT_MAX - d->count && (d->offset % d->alloc) == d->start; } inline void normalizeIndexes() { d->offset = d->start; } - // debug + +#ifdef QT_QCONTIGUOUSCACHE_DEBUG void dump() const { p->dump(); } +#endif private: void detach_helper(); -- cgit v0.12