]> granicus.if.org Git - icu/commitdiff
ICU-10802 ifdef away unified cache diagnostic code that uses stdio.h.
authorTravis Keep <keep94@gmail.com>
Thu, 21 Aug 2014 17:16:46 +0000 (17:16 +0000)
committerTravis Keep <keep94@gmail.com>
Thu, 21 Aug 2014 17:16:46 +0000 (17:16 +0000)
X-SVN-Rev: 36225

icu4c/source/common/unifiedcache.cpp
icu4c/source/common/unifiedcache.h

index 11bba9bb3d84ecf25c2a39b21dc0a28f1613569b..ab9a3bbebb06ecfe7df99079cc54559f8d718c93 100644 (file)
@@ -14,7 +14,6 @@
 #include "mutex.h"
 #include "uassert.h"
 #include "ucln_cmn.h"
-#include <stdio.h>
 
 static icu::UnifiedCache *gCache = NULL;
 static icu::SharedObject *gNoValue = NULL;
@@ -126,6 +125,9 @@ void UnifiedCache::flush() const {
     umtx_condBroadcast(&gInProgressValueAddedCond);
 }
 
+#ifdef UNIFIED_CACHE_DEBUG
+#include <stdio.h>
+
 void UnifiedCache::dump() {
     UErrorCode status = U_ZERO_ERROR;
     const UnifiedCache *cache = getInstance(status);
@@ -168,6 +170,7 @@ void UnifiedCache::_dumpContents() const {
     }
     fprintf(stderr, "Unified Cache: %d out of a total of %d still have hard references\n", cnt, uhash_count(fHashtable));
 }
+#endif
 
 UnifiedCache::~UnifiedCache() {
     // Try our best to clean up first.
index 8213d9fdbdc999cbe1f58ec20b3ee04e7ebbe3f7..1bab61c5d12fe6eb651c21c59761a40084be599c 100644 (file)
@@ -237,11 +237,13 @@ class U_COMMON_API UnifiedCache : public UObject {
        }
    }
 
+#ifdef UNIFIED_CACHE_DEBUG
    /**
     * Dumps the contents of this cache to standard error. Used for testing of
     * cache only.
     */
    void dumpContents() const;
+#endif
 
    /**
     * Convenience method to get a value of type T from cache for a
@@ -265,10 +267,12 @@ class U_COMMON_API UnifiedCache : public UObject {
        cache->get(LocaleCacheKey<T>(loc), ptr, status);
    }
 
+#ifdef UNIFIED_CACHE_DEBUG
    /**
     * Dumps the cache contents to stderr. For testing only.
     */
    static void dump();
+#endif
 
    /**
     * Returns the number of keys in this cache. For testing only.
@@ -305,7 +309,9 @@ class U_COMMON_API UnifiedCache : public UObject {
            const CacheKeyBase &key,
            const SharedObject *&value,
            UErrorCode &status) const;
+#ifdef UNIFIED_CACHE_DEBUG
    void _dumpContents() const;
+#endif
    static void _put(
            const UHashElement *element,
            const SharedObject *value,