From 6f9dd8c75a39e4a8b5875329c9b5745ce0b748bf Mon Sep 17 00:00:00 2001 From: Travis Keep Date: Thu, 21 Aug 2014 17:16:46 +0000 Subject: [PATCH] ICU-10802 ifdef away unified cache diagnostic code that uses stdio.h. X-SVN-Rev: 36225 --- icu4c/source/common/unifiedcache.cpp | 5 ++++- icu4c/source/common/unifiedcache.h | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/icu4c/source/common/unifiedcache.cpp b/icu4c/source/common/unifiedcache.cpp index 11bba9bb3d8..ab9a3bbebb0 100644 --- a/icu4c/source/common/unifiedcache.cpp +++ b/icu4c/source/common/unifiedcache.cpp @@ -14,7 +14,6 @@ #include "mutex.h" #include "uassert.h" #include "ucln_cmn.h" -#include 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 + 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. diff --git a/icu4c/source/common/unifiedcache.h b/icu4c/source/common/unifiedcache.h index 8213d9fdbdc..1bab61c5d12 100644 --- a/icu4c/source/common/unifiedcache.h +++ b/icu4c/source/common/unifiedcache.h @@ -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(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, -- 2.40.0