/* * Attempts to remove the element from the set. * * Arguments: * set -- The set to remove the element from * element -- The element to remove from the set */ void setRemove( Set *set, void *element ) { void *removed = bstRemove( set->elements, element ); if( removed ) { free( removed ); set->size -= 1; } }
/******************************************************************************* * Attempts to remove a Website from a hash table and BST. * * Pre: pList points to a list with a hash table and BST. * url is the url of the Website to remove. * * Post: The hash table and BST do not contain a website with that URL. * If they did, it has been destroyed. * * Return: true if the Website was successfully removed, * false if it was not found. ******************************************************************************/ bool listRemove(ListHead *pList, const char *url) { Website *pWebsite; pWebsite = hashSearch(pList, url); if(pWebsite) { bstRemove(pList, url); websiteFree(pWebsite); return true; } else { return false; } }