nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
alist.c File Reference
#include <stddef.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "alist.h"
Include dependency graph for alist.c:

Go to the source code of this file.

Data Structures

struct  alist
 This alist is called Allocatable Modified Doubly Linked List (inherited from dlist). More...
 

Functions

struct alistalist_append (struct alist *list, struct alist *new)
 
int alist_count (struct alist *l)
 
struct alistalist_next (struct alist *l)
 
struct alistalist_nth (struct alist *l, int nth)
 
struct alistalist_prepend (struct alist *list, struct alist *new)
 
struct alistalist_prev (struct alist *l)
 
struct alistalist_remove (struct alist *list, struct alist *l)
 

Function Documentation

struct alist* alist_append ( struct alist list,
struct alist new 
)

Definition at line 28 of file alist.c.

References alist::next, NULL, and alist::prev.

int alist_count ( struct alist l)

Definition at line 104 of file alist.c.

References alist_foreach.

struct alist* alist_next ( struct alist l)

Definition at line 94 of file alist.c.

References alist::next, and NULL.

struct alist* alist_nth ( struct alist l,
int  nth 
)

Definition at line 117 of file alist.c.

References alist::next, and NULL.

struct alist* alist_prepend ( struct alist list,
struct alist new 
)

Definition at line 45 of file alist.c.

References alist::next, NULL, and alist::prev.

struct alist* alist_prev ( struct alist l)

Definition at line 99 of file alist.c.

References NULL, and alist::prev.

struct alist* alist_remove ( struct alist list,
struct alist l 
)
Note
If the removed entry 'l' has no next element, it is the last element. In this case, check the existence of the list first, and if the list is not empty, update the 'prev' of the list (which is a head element of the list)

If we didn't care about this, the head element(list) can indicates the invalid element.

Definition at line 64 of file alist.c.

References alist::next, NULL, and alist::prev.