/* * This function frees the memory it allocated */ static void AyStarMain_Free(AyStar *aystar) { aystar->OpenListQueue.free(&aystar->OpenListQueue, false); /* 2nd argument above is false, below is true, to free the values only * once */ delete_Hash(&aystar->OpenListHash, true); delete_Hash(&aystar->ClosedListHash, true); #ifdef AYSTAR_DEBUG printf("[AyStar] Memory free'd\n"); #endif }
Hash resize_Hash(Hash H, unsigned int newLength){ List l; List_Iter it; unsigned int i; Hash newHash; assert(newLength); newHash = new_Hash(newLength); for (i = 0; i < H->length; ++i){ l = H->lists[i]; it = begin_List(l); while (it != end_List(l)){ add_Hash(newHash, getElem_List(l, it)); it = next_List(l, it); } } delete_Hash(H); return newHash; }