Hello All,

Quick development question for you (nice on a Friday afternoon).

I've a hashtable_t containing elements and I want to delete all elements
from that hashtable_t. And use the hashtable_t again afterwards.

I can see that hashtable_t supports getting, setting and removing of
elements. These are only applicable if you know the element key before hand.

I can see that hashtable_t also supports an enumerator_t to iterate over the
elements.

It seems to me that the only way to delete all elements in the hashtable_t
is to create an enumerator, enumerate over the elements and call remove for
each element found.

Does the hashtable_t+enumerator_t support this mode of operation ? I'm
worried about pulling the rug out from under the feet of the enumerator_t by
deleting items in the middle of the hashtable_t while I'm enumerating
through it.

Or, is there a better way of doing this ?

If all else fails, it may be better to free all the memory that the elements
point to and to then destroy the hashtable_t and create a new one.

Regards,

Graham.
_______________________________________________
Users mailing list
[email protected]
https://lists.strongswan.org/mailman/listinfo/users

Reply via email to