#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "glist.h"
#include "ckd_alloc.h"
Functions | |
glist_t | glist_add_ptr (glist_t g, void *ptr) |
glist_t | glist_add_int32 (glist_t g, int32 val) |
glist_t | glist_add_uint32 (glist_t g, uint32 val) |
glist_t | glist_add_float32 (glist_t g, float32 val) |
glist_t | glist_add_float64 (glist_t g, float64 val) |
void | glist_free (glist_t g) |
int32 | glist_count (glist_t g) |
gnode_t * | glist_tail (glist_t g) |
glist_t | glist_reverse (glist_t g) |
gnode_t * | glist_insert_ptr (gnode_t *gn, void *ptr) |
gnode_t * | glist_insert_int32 (gnode_t *gn, int32 val) |
gnode_t * | glist_insert_uint32 (gnode_t *gn, uint32 val) |
gnode_t * | glist_insert_float32 (gnode_t *gn, float32 val) |
gnode_t * | glist_insert_float64 (gnode_t *gn, float64 val) |
gnode_t * | gnode_free (gnode_t *gn, gnode_t *pred) |
Create and prepend a new list node containing a single-precision float.
g | a link list | |
val | a float32 vlaue |
Create and prepend a new list node containing a double-precision float.
g | a link list | |
val | a float64 vlaue |
Create and prepend a new list node containing an integer.
g | a link list | |
val | an integer value |
Create and prepend a new list node, with the given user-defined data, at the HEAD of the given generic list. Return the new list thus formed. g may be NULL to indicate an initially empty list.
g | a link list | |
ptr | a pointer |
Create and prepend a new list node containing an unsigned integer.
g | a link list | |
val | an unsigned integer value |
Count the number of element in a given link list
g | input link list |
void glist_free | ( | glist_t | g | ) |
Free the given generic list; user-defined data contained within is not automatically freed. The caller must have done that already.
Create and insert a new list node containing a single-precision float.
gn | a generic node which a value will be inserted after it | |
val | float32 inserted |
Create and insert a new list node containing a double-precision float.
gn | a generic node which a value will be inserted after it | |
val | float64 inserted |
Create and insert a new list node containing an integer.
gn | a generic node which a value will be inserted after it | |
val | int32 inserted |
Create and insert a new list node, with the given user-defined data, after the given generic node gn. gn cannot be NULL. Return ptr to the newly created gnode_t.
gn | a generic node which ptr will be inserted after it | |
ptr | pointer inserted |
Create and insert a new list node containing an unsigned integer.
gn | a generic node which a value will be inserted after it | |
val | uint32 inserted |
Reverse the order of the given glist. (glist_add() adds to the head; one might ultimately want the reverse of that.) NOTE: The list is reversed "in place"; i.e., no new memory is allocated.
g | input link list |