New routines for key/value copy and free in hash tables

With the routines for key/value copy and free it is possible to
duplicate or free different data types in the hash tables.

The user_alloc() routine is the first example.
This commit is contained in:
MassimilianoPinto
2014-01-08 17:02:59 +01:00
parent a6dbb20aa9
commit dfc224c292
3 changed files with 48 additions and 28 deletions

View File

@ -27,8 +27,11 @@
* @verbatim
* Revision History
*
* Date Who Description
* 23/06/13 Mark Riddoch Initial implementation
* Date Who Description
* 23/06/2013 Mark Riddoch Initial implementation
* 08/01/2014 Massimiliano Pinto In user_alloc now we can pass function pointers for
* copying/freeing keys and values independently via
* hashtable_memory_fns() routine
*
* @endverbatim
*/
@ -64,7 +67,7 @@ USERS *rval;
return NULL;
}
hashtable_memory_fns(rval->data, (HASHMEMORYFN)strdup, (HASHMEMORYFN)free);
hashtable_memory_fns(rval->data, (HASHMEMORYFN)strdup, (HASHMEMORYFN)strdup, (HASHMEMORYFN)free, (HASHMEMORYFN)free);
return rval;
}