1) To let the management of the memory of the values to the entity
using the module. This sound really bad for me, since the client
would need to dispose all the values contained in the hash before
to destroy it. It is error prone.
For hash tables containing different types of objects, maybe this is not
the best solution.
2) To specify the element memory disposal function at element
insertion time, like:
pdf_hash_add (myhash,
"key",
a_text_variable,
memory_disposal_function_for_text_variables);
In this case would be quite useful to have some element disposal
functions written for the several pdf_*_t types, including the
pdf_hash_t one.
I really think this would be the best and simplest option.
3) To change the way the hash module works by introducing
typed-values. That is, to restrict the contents of a hash entry to
a predefined set of types, like:
pdf_hash_add_text (myhash,
"key",
a_text_variable);
pdf_hash_add_u32 (myhash,
"FileSize",
pdf_u32_value);
In this case we will need to expand the pdf-hash API to be able to
ask the type of a given entry:
pdf_hash_entry_type_t pdf_hash_entry_type (myhash, "key");
This involves unnecessary work when trying to include new object types
in the hash table.
Just my opinion :-)
-Aleksander