fixed various bugs in a map and enhanced it.

- added ase_strbytes returning the number of bytes of a '\0'-terminated string
 - changed the prototype of ase_map_walker_t to return ase_map_walk_t 
 - added ASE_MAP_KCLEN and ASE_MAP_VCLEN
 - fixed the bug of not initializing the bucket in ase_map_init
 - fixed the bug of returning 0 when a match is found in ase_map_search
 - fixed the bug of wrongly calculating the value pointer in alloc_pair
This commit is contained in:
2008-09-25 01:18:50 +00:00
parent 21c331febf
commit a88cc05eae
5 changed files with 55 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: str_dyn.c 375 2008-09-23 14:47:23Z baconevi $
* $Id: str_dyn.c 376 2008-09-24 07:18:50Z baconevi $
*
* {License}
*/
@ -11,6 +11,16 @@ ase_str_t* ase_str_open (ase_mmgr_t* mmgr, ase_size_t ext, ase_size_t capa)
{
ase_str_t* str;
if (mmgr == ASE_NULL)
{
mmgr = ASE_MMGR_GETDFL();
ASE_ASSERTX (mmgr != ASE_NULL,
"Set the memory manager with ASE_MMGR_SETDFL()");
if (mmgr == ASE_NULL) return ASE_NULL;
}
str = (ase_str_t*) ASE_MMGR_ALLOC (mmgr, ASE_SIZEOF(ase_str_t) + ext);
if (str == ASE_NULL) return ASE_NULL;