/* Allocate and Initialise a WordFM. */ WordFM* newFM( void* (*alloc_nofail)( SizeT ), void (*dealloc)(void*), Word (*kCmp)(Word,Word) ) { WordFM* fm = alloc_nofail(sizeof(WordFM)); assert(fm); initFM(fm, alloc_nofail, dealloc, kCmp); return fm; }
/* Allocate and initialise a WordFM. If kCmp is non-NULL, elements in the set are ordered according to the ordering specified by kCmp, which becomes obvious if you use VG_(initIterFM), VG_(initIterAtFM), VG_(nextIterFM), VG_(doneIterFM) to iterate over sections of the map, or the whole thing. If kCmp is NULL then the ordering used is unsigned word ordering (UWord) on the key values. */ WordFM* VG_(newFM) ( void* (*alloc_nofail)( const HChar*, SizeT ), const HChar* cc, void (*dealloc)(void*), Word (*kCmp)(UWord,UWord) ) { WordFM* fm = alloc_nofail(cc, sizeof(WordFM)); tl_assert(fm); initFM(fm, alloc_nofail, cc, dealloc, kCmp); return fm; }