You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
#include <fusenetincludes.h>
|
|
#include <tlist.h>
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// slist::insert
|
|
// Insert single link element at head.
|
|
//-----------------------------------------------------------------------------
|
|
void slist::insert(slink *p)
|
|
{
|
|
if (last)
|
|
p->next = last->next;
|
|
else
|
|
last = p;
|
|
|
|
last->next = p;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// slist::append
|
|
// Append single link element at tail.
|
|
//-----------------------------------------------------------------------------
|
|
void slist::append(slink* p)
|
|
{
|
|
if (last)
|
|
{
|
|
p->next = last->next;
|
|
last = last->next = p;
|
|
}
|
|
else
|
|
last = p->next = p;
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// slist::get
|
|
// Return next single link element ptr.
|
|
//-----------------------------------------------------------------------------
|
|
slink* slist::get()
|
|
{
|
|
if (last == NULL)
|
|
return NULL;
|
|
|
|
slink* p = last->next;
|
|
|
|
if (p == last)
|
|
last = NULL;
|
|
else
|
|
last->next = p->next;
|
|
|
|
return p;
|
|
}
|