static Boolean unsetGroupsockBySocket(Groupsock const* groupsock) { do { if (groupsock == NULL) break; int sock = groupsock->socketNum(); // Make sure "sock" is in bounds: if (sock < 0) break; HashTable* sockets = getSocketTable(groupsock->env()); if (sockets == NULL) break; Groupsock* gs = (Groupsock*)sockets->Lookup((char*)(long)sock); if (gs == NULL || gs != groupsock) break; sockets->Remove((char*)(long)sock); if (sockets->IsEmpty()) { // We can also delete the table (to reclaim space): delete sockets; (gs->env()).groupsockPriv = NULL; } return True; } while (0); return False; }
void MediaLookupTable::remove(char const* name) { Medium* medium = lookup(name); if (medium != NULL) { fTable->Remove(name); if (fTable->IsEmpty()) { // We can also delete ourselves (to reclaim space): _Tables* ourTables = _Tables::getOurTables(fEnv); delete this; ourTables->mediaTable = NULL; ourTables->reclaimIfPossible(); } delete medium; } }