Esempio n. 1
0
static void objRemove(void **objReturn, objectTable table,
                      void *logObj, size_t size)
{
  Bool found;
  Res ires;
  void *obj;
  void *end;
  void *logEnd;

  found = TableLookup(&obj, table->startTable, (Word)logObj);
  if (found) {
    ires = TableRemove(table->startTable, (Word)logObj);
    verify(ires == ResOK);
    if (table->endTable != NULL) {
      ires = TableRemove(table->endTable,
                         (Word)PointerAdd(logObj, size));
      verify(ires == ResOK);
    }
    *objReturn = obj;
    return;
  }
  /* Must be a truncation. */
  verify(table->endTable != NULL);
  logEnd = PointerAdd(logObj, size);
  found = TableLookup(&end, table->endTable, (Word)logEnd);
  verify(found);
  obj = PointerSub(end, size);
  /* Remove the old end and insert the new one. */
  ires = TableRemove(table->endTable, (Word)logEnd);
  verify(ires == ResOK);
  ires = TableDefine(table->endTable, (Word)logObj, obj);
  verify(ires == ResOK);
  *objReturn = obj;
  return;
}
Esempio n. 2
0
static void piCleanseGlobalCacheMap
(
	void * elem,
	void * clientData
)
{
	piPlayer * player;
	int roomType;
	piCacheKey * cacheKey = (piCacheKey *)elem;
	PEER peer = (PEER)clientData;
	piConnection * connection = (piConnection *)peer;
	piWatchKey watchKeyTemp;

	watchKeyTemp.key = cacheKey->key;

	player = piGetPlayer(peer, cacheKey->nick);
	if(player)
	{
		for(roomType = 0 ; roomType < NumRooms ; roomType++)
		{
			if(player->inRoom[roomType])
			{
				if(TableLookup(connection->globalWatchKeys[roomType], &watchKeyTemp))
					return;
			}
		}
	}

	TableRemove(connection->globalWatchCache, cacheKey);
}
Esempio n. 3
0
static void piRemoveXping
(
	PEER peer,
	piXping * xping
)
{
	PEER_CONNECTION;
	
	assert(xping);

	TableRemove(connection->xpings, xping);
}
Esempio n. 4
0
static void piRemoveExistingKeysMap
(
	void * elem,
	void * clientData
)
{
	int i;

	piWatchKey * key = (piWatchKey *)elem;
	piRemoveExistingKeysData * data = (piRemoveExistingKeysData *)clientData;

	for(i = 0 ; i < data->num ; i++)
		if(strcasecmp(key->key, data->keys[i]) == 0)
			return;

	TableRemove(data->watchKeys, key);
}
Esempio n. 5
0
void FreeUp( LPVOID lpMemory )
/************************************************************************/
{
HGLOBAL hMem;

if ( !lpMemory )
	return;

if ( !(hMem = GlobalPtrHandle(lpMemory)) )
	return;

#ifdef _DEBUG_MEMORY
	TableRemove( lpMemory );
#endif

GlobalUnlock(hMem);
GlobalFree(hMem);
}
Esempio n. 6
0
static void piCleanseRoomCacheMap
(
	void * elem,
	void * clientData
)
{
	piPlayer * player;
	piCacheKey * cacheKey = (piCacheKey *)elem;
	piCleanseRoomCacheMapData * data = (piCleanseRoomCacheMapData *)clientData;
	piConnection * connection = (piConnection *)data->peer;
	piWatchKey watchKeyTemp;

	watchKeyTemp.key = cacheKey->key;

	player = piGetPlayer(data->peer, cacheKey->nick);
	if(player && player->inRoom[data->roomType])
	{
		if(TableLookup(connection->roomWatchKeys[data->roomType], &watchKeyTemp))
			return;
	}

	TableRemove(connection->globalWatchCache, cacheKey);
}