Example #1
0
void *
LL_Shift (LinkedList * list)				  // Remove node from start of list
{
	if (!list)
		return NULL;

	if (0 > LL_Rewind (list))
		return NULL;

	return LL_DeleteNode (list);
}
Example #2
0
void *
LL_Pop (LinkedList * list)				  // Remove node from end of list
{
	if (!list)
		return NULL;

	if (0 > LL_End (list))
		return NULL;

	return LL_DeleteNode (list);
}
////////////////////////////////////////////////////////////////////////////////
//
//   Name:          LL_DestroyList
//
//   Type:          Function
//
//   Description:   Destroy a list
//
//   Inputs:        pThisNode -  the head of the list
//
//   Outputs:       void
//
////////////////////////////////////////////////////////////////////////////////
void LL_DestroyList (NodeFunctions *LLFunctions, P_Node pThisNode)
{
    P_Node pTempNode;

    while (pThisNode != NULL)
    {
        pTempNode = pThisNode;
        pThisNode = pThisNode->right;

		LL_DeleteNode(LLFunctions, pTempNode, REMOVE_ALL);
    }
}
Example #4
0
//////////////////////////////////////////////////////////////////////
// Removes a specific node...
void *
LL_Remove (LinkedList * list, void *data)
{
	void *find;

	if (!list)
		return NULL;

	LL_Rewind (list);
	do {
		find = LL_Get (list);
		if (find == data)
			return LL_DeleteNode (list);
	} while (LL_Next (list) == 0);

	return NULL;
}
Example #5
0
void input_release_key(const char *key, Client *client)
{
	KeyReservation *kr;

	debug(RPT_DEBUG, "%s(key=\"%.40s\", client=[%d])", __FUNCTION__, key, (client?client->sock:-1));

	for (kr = LL_GetFirst(keylist); kr; kr = LL_GetNext(keylist)) {
		if (kr->client == client
		&& strcmp(kr->key, key) == 0) {
			free(kr->key);
			free(kr);
			LL_DeleteNode(keylist);
			report(RPT_INFO, "Key \"%.40s\" was reserved in %s mode by client [%d] and is now released", key, (kr->exclusive?"exclusive":"shared"), (client?client->sock:-1));
			return;
		}
	}
}
Example #6
0
void input_release_client_keys(Client *client)
{
	KeyReservation *kr;

	debug(RPT_DEBUG, "%s(client=[%d])", __FUNCTION__, (client?client->sock:-1));

	kr=LL_GetFirst(keylist);
	while (kr) {
		if (kr->client == client) {
			report(RPT_INFO, "Key \"%.40s\" was reserved in %s mode by client [%d] and is now released", kr->key, (kr->exclusive?"exclusive":"shared"), (client?client->sock:-1));
			free(kr->key);
			free(kr);
			LL_DeleteNode(keylist);
			kr = LL_Get(keylist);
		} else {
			kr = LL_GetNext(keylist);
		}
	}
}