From 9cdf3f1556c0cf0026cd468f08a97f74bdbe29c1 Mon Sep 17 00:00:00 2001
From: David Abram Cargill <cargilld@apache.org>
Date: Fri, 17 Mar 2006 21:33:11 +0000
Subject: [PATCH] Quicker check if container is empty.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@386723 13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/util/NameIdPool.c         | 2 ++
 src/xercesc/util/RefHash3KeysIdPool.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/xercesc/util/NameIdPool.c b/src/xercesc/util/NameIdPool.c
index dc7ed04e5..17d035e3e 100644
--- a/src/xercesc/util/NameIdPool.c
+++ b/src/xercesc/util/NameIdPool.c
@@ -118,6 +118,8 @@ NameIdPool<TElem>::containsKey(const XMLCh* const key) const
 
 template <class TElem> void NameIdPool<TElem>::removeAll()
 {
+    if (fIdCounter == 0) return;
+
     // Clean up the buckets first
     for (unsigned int buckInd = 0; buckInd < fHashModulus; buckInd++)
     {
diff --git a/src/xercesc/util/RefHash3KeysIdPool.c b/src/xercesc/util/RefHash3KeysIdPool.c
index 5b38560d0..ac73cfa71 100644
--- a/src/xercesc/util/RefHash3KeysIdPool.c
+++ b/src/xercesc/util/RefHash3KeysIdPool.c
@@ -181,6 +181,8 @@ containsKey(const void* const key1, const int key2, const int key3) const
 
 template <class TVal> void RefHash3KeysIdPool<TVal>::removeAll()
 {
+    if (fIdCounter == 0) return;
+
     // Clean up the buckets first
     for (unsigned int buckInd = 0; buckInd < fHashModulus; buckInd++)
     {
-- 
GitLab