#ifndef __SINGLE_LIST_H__ #define __SINGLE_LIST_H__ typedef struct single_node { int value; struct single_node *next; } single_node_t; typedef struct single_list { struct single_node *head; struct single_node *tail; int size; } single_list_t; // This must appear right at the end of the local variable declarations, // as they contain both a declaration and an initialization #define SINGLE_LIST_INIT( x ) \ single_list_t x; \ single_list_init( &x ) #define SINGLE_LIST_MALLOC( x ) \ single_list_t *x = (single_list_t *) malloc( sizeof( single_list_t ) ); \ single_list_init( x ) void single_list_init( single_list_t *const list ); void single_list_destroy( single_list_t *const list ); int single_list_front( single_list_t *const list ); int single_list_back( single_list_t *const list ); void single_list_push_front( single_list_t *const list, int n ); void single_list_pop_front( single_list_t *const list ); #endif