projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed USING_CONFIGURE define. As VZ pointed out, checking HAVE_CONFIG_H
[wxWidgets.git]
/
src
/
common
/
hash.cpp
diff --git
a/src/common/hash.cpp
b/src/common/hash.cpp
index f4139dd5f9d7beadf69ad7de653a1d401e1fc6e3..691d70832cb1c426c7b61bcff44160966c22a35e 100644
(file)
--- a/
src/common/hash.cpp
+++ b/
src/common/hash.cpp
@@
-48,11
+48,18
@@
wxHashTable::wxHashTable (int the_key_type, int size)
wxHashTable::~wxHashTable (void)
{
wxHashTable::~wxHashTable (void)
{
+ Destroy();
+}
+
+void wxHashTable::Destroy(void)
+{
+ if (!hash_table) return;
int i;
for (i = 0; i < n; i++)
if (hash_table[i])
delete hash_table[i];
delete[] hash_table;
int i;
for (i = 0; i < n; i++)
if (hash_table[i])
delete hash_table[i];
delete[] hash_table;
+ hash_table = NULL;
}
bool wxHashTable::Create(int the_key_type, int size)
}
bool wxHashTable::Create(int the_key_type, int size)
@@
-85,7
+92,7
@@
void wxHashTable::Put (long key, long value, wxObject * object)
hash_table[position]->Append (value, object);
}
hash_table[position]->Append (value, object);
}
-void wxHashTable::Put (long key, const
c
har *value, wxObject * object)
+void wxHashTable::Put (long key, const
wxC
har *value, wxObject * object)
{
// Should NEVER be
long k = (long) key;
{
// Should NEVER be
long k = (long) key;
@@
-113,7
+120,7
@@
void wxHashTable::Put (long key, wxObject * object)
hash_table[position]->Append (k, object);
}
hash_table[position]->Append (k, object);
}
-void wxHashTable::Put (const
c
har *key, wxObject * object)
+void wxHashTable::Put (const
wxC
har *key, wxObject * object)
{
int position = (int) (MakeKey (key) % n);
{
int position = (int) (MakeKey (key) % n);
@@
-143,7
+150,7
@@
wxObject *wxHashTable::Get (long key, long value) const
}
}
}
}
-wxObject *wxHashTable::Get (long key, const
c
har *value) const
+wxObject *wxHashTable::Get (long key, const
wxC
har *value) const
{
// Should NEVER be
long k = (long) key;
{
// Should NEVER be
long k = (long) key;
@@
-180,7
+187,7
@@
wxObject *wxHashTable::Get (long key) const
}
}
}
}
-wxObject *wxHashTable::Get (const
c
har *key) const
+wxObject *wxHashTable::Get (const
wxC
har *key) const
{
int position = (int) (MakeKey (key) % n);
{
int position = (int) (MakeKey (key) % n);
@@
-217,7
+224,7
@@
wxObject *wxHashTable::Delete (long key)
}
}
}
}
-wxObject *wxHashTable::Delete (const
c
har *key)
+wxObject *wxHashTable::Delete (const
wxC
har *key)
{
int position = (int) (MakeKey (key) % n);
if (!hash_table[position])
{
int position = (int) (MakeKey (key) % n);
if (!hash_table[position])
@@
-260,7
+267,7
@@
wxObject *wxHashTable::Delete (long key, int value)
}
}
}
}
-wxObject *wxHashTable::Delete (long key, const
c
har *value)
+wxObject *wxHashTable::Delete (long key, const
wxC
har *value)
{
int position = (int) (key % n);
if (!hash_table[position])
{
int position = (int) (key % n);
if (!hash_table[position])
@@
-279,12
+286,12
@@
wxObject *wxHashTable::Delete (long key, const char *value)
}
}
}
}
-long wxHashTable::MakeKey (const
c
har *string) const
+long wxHashTable::MakeKey (const
wxC
har *string) const
{
long int_key = 0;
while (*string)
{
long int_key = 0;
while (*string)
- int_key += (
unsigned c
har) *string++;
+ int_key += (
wxUC
har) *string++;
return int_key;
}
return int_key;
}