ICU-10802 ifdef away unified cache diagnostic code that uses stdio.h.

X-SVN-Rev: 36225
This commit is contained in:
Travis Keep 2014-08-21 17:16:46 +00:00
parent 00cf4a43d4
commit 6f9dd8c75a
2 changed files with 10 additions and 1 deletions

View 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.

View 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,