53 lines
1.2 KiB
C
53 lines
1.2 KiB
C
/* See the end of this file for copyright and license terms. */
|
|
|
|
#include <gay/clist.h>
|
|
#include <gay/config.h>
|
|
|
|
void clist_init(struct clist *head)
|
|
{
|
|
head->next = head;
|
|
head->prev = head;
|
|
}
|
|
|
|
void clist_add(struct clist *head, struct clist *new)
|
|
{
|
|
head->next->prev = new;
|
|
new->next = head->next;
|
|
|
|
new->prev = head;
|
|
head->next = new;
|
|
}
|
|
|
|
void clist_add_end(struct clist *head, struct clist *new)
|
|
{
|
|
head->prev->next = new;
|
|
new->next = head;
|
|
|
|
new->prev = head->prev;
|
|
head->prev = new;
|
|
}
|
|
|
|
void clist_del(struct clist *node)
|
|
{
|
|
node->next->prev = node->prev;
|
|
node->prev->next = node->next;
|
|
|
|
# ifdef DEBUG
|
|
node->next = NULL;
|
|
node->prev = NULL;
|
|
# endif
|
|
}
|
|
|
|
/*
|
|
* This file is part of GayBSD.
|
|
* Copyright (c) 2021 fef <owo@fef.moe>.
|
|
*
|
|
* GayBSD is nonviolent software: you may only use, redistribute, and/or
|
|
* modify it under the terms of the Cooperative Nonviolent Public License
|
|
* (CNPL) as found in the LICENSE file in the source code root directory
|
|
* or at <https://git.pixie.town/thufie/npl-builder>; either version 7
|
|
* of the license, or (at your option) any later version.
|
|
*
|
|
* GayBSD comes with ABSOLUTELY NO WARRANTY, to the extent
|
|
* permitted by applicable law. See the CNPL for details.
|
|
*/
|