mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-19 02:29:31 -05:00
The files are now stored under : - include/haproxy for the generic includes - include/types.h for the structures needed within prototypes - include/proto.h for function prototypes and inline functions - src/*.c for the C files Most include files are now covered by LGPL. A last move still needs to be done to put inline functions under GPL and not LGPL. Version has been set to 1.3.0 in the code but some control still needs to be done before releasing.
84 lines
2.8 KiB
C
84 lines
2.8 KiB
C
/*
|
|
This File is copied from
|
|
|
|
http://www.oreilly.com/catalog/masteralgoc/index.html
|
|
Mastering Algorithms with C
|
|
By Kyle Loudon
|
|
ISBN: 1-56592-453-3
|
|
Publishd by O'Reilly
|
|
|
|
*/
|
|
|
|
/*****************************************************************************
|
|
* *
|
|
* -------------------------------- list.h -------------------------------- *
|
|
* *
|
|
*****************************************************************************/
|
|
|
|
#ifndef _HAPROXY_LIST_H
|
|
#define _HAPROXY_LIST_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
/*****************************************************************************
|
|
* *
|
|
* Define a structure for linked list elements. *
|
|
* *
|
|
*****************************************************************************/
|
|
|
|
typedef struct ListElmt_ {
|
|
void *data;
|
|
struct ListElmt_ *next;
|
|
} ListElmt;
|
|
|
|
/*****************************************************************************
|
|
* *
|
|
* Define a structure for linked lists. *
|
|
* *
|
|
*****************************************************************************/
|
|
|
|
typedef struct List_ {
|
|
int size;
|
|
int (*match)(const void *key1, const void *key2);
|
|
void (*destroy)(void *data);
|
|
|
|
ListElmt *head;
|
|
ListElmt *tail;
|
|
} List;
|
|
|
|
/*****************************************************************************
|
|
* *
|
|
* --------------------------- Public Interface --------------------------- *
|
|
* *
|
|
*****************************************************************************/
|
|
|
|
void list_init(List *list, void (*destroy)(void *data));
|
|
|
|
void list_destroy(List *list);
|
|
|
|
int list_ins_next(List *list, ListElmt *element, const void *data);
|
|
|
|
int list_rem_next(List *list, ListElmt *element, void **data);
|
|
|
|
#define list_size(list) ((list)->size)
|
|
|
|
#define list_head(list) ((list)->head)
|
|
|
|
#define list_tail(list) ((list)->tail)
|
|
|
|
#define list_is_head(list, element) ((element) == (list)->head ? 1 : 0)
|
|
|
|
#define list_is_tail(element) ((element)->next == NULL ? 1 : 0)
|
|
|
|
#define list_data(element) ((element)->data)
|
|
|
|
#define list_next(element) ((element)->next)
|
|
|
|
#endif /* _HAPROXY_LIST_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|