Import cube_2005_08_29_src_zlib.zip

FossilOrigin-Name: ea7418102a3ee6b415e50bea95694727a4f62ae112b570a07310817614ea3063
This commit is contained in:
Jonathan Schleifer 2024-07-13 14:22:15 +00:00
parent 88989814f6
commit 79db1ed9fa
144 changed files with 45421 additions and 0 deletions

57
enet/list.c Normal file
View file

@ -0,0 +1,57 @@
/**
@file list.c
@brief ENet linked list functions
*/
#define ENET_BUILDING_LIB 1
#include "enet/list.h"
/**
@defgroup list ENet linked list utility functions
@ingroup private
@{
*/
void
enet_list_clear (ENetList * list)
{
list -> sentinel.next = & list -> sentinel;
list -> sentinel.previous = & list -> sentinel;
}
ENetListIterator
enet_list_insert (ENetListIterator position, void * data)
{
ENetListIterator result = (ENetListIterator) data;
result -> previous = position -> previous;
result -> next = position;
result -> previous -> next = result;
position -> previous = result;
return result;
}
void *
enet_list_remove (ENetListIterator position)
{
position -> previous -> next = position -> next;
position -> next -> previous = position -> previous;
return position;
}
size_t
enet_list_size (ENetList * list)
{
size_t size = 0;
ENetListIterator position;
for (position = enet_list_begin (list);
position != enet_list_end (list);
position = enet_list_next (position))
++ size;
return size;
}
/** @} */