ICU-1079 add utility deleters for UVector and Hashtable

X-SVN-Rev: 5413
This commit is contained in:
Alan Liu 2001-08-01 17:37:37 +00:00
parent caa1bdd17e
commit 38a35f8596
2 changed files with 32 additions and 0 deletions

View File

@ -502,6 +502,18 @@ uhash_compareLong(const UHashKey key1, const UHashKey key2);
* Other Support Functions
********************************************************************/
/**
* Deleter for Hashtable objects.
*/
U_CAPI void
uhash_deleteHashtable(void *obj);
/**
* Deleter for UVector objects.
*/
U_CAPI void
uhash_deleteUVector(void *obj);
/**
* Deleter for any key or value allocated using uprv_malloc. Calls
* uprv_free.

View File

@ -11,6 +11,8 @@
*/
#include "uhash.h"
#include "hash.h"
#include "uvector.h"
#include "unicode/unistr.h"
/********************************************************************
@ -65,3 +67,21 @@ uhash_compareCaselessUnicodeString(const UHashKey key1, const UHashKey key2) {
}
return str1->caseCompare(*str2, U_FOLD_CASE_DEFAULT) == 0;
}
/**
* Deleter for Hashtable objects.
*/
U_CAPI void
uhash_deleteHashtable(void *obj) {
delete (Hashtable*) obj;
}
/**
* Deleter for UVector objects.
*/
U_CAPI void
uhash_deleteUVector(void *obj) {
delete (UVector*) obj;
}
//eof