mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-19 09:01:05 +01:00
O'Reilly has clarified its license affecting 6 files contained in haproxy up to and including 1.3.12.X. The updated license has been included within these files. These files are no longer present in versions starting from 1.3.13, but it was better to clear any doubt about the redistribution conditions at least for 1.3.12. Special thanks to the people at the Fedora Project for their efforts in getting in touch with O'Reilly to clarify the license.
111 lines
4.0 KiB
C
111 lines
4.0 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
|
|
|
|
Updated O'Reilly's copyright notice follows :
|
|
|
|
Copyright (c) 1999 O'Reilly & Associates, Inc.
|
|
|
|
Mastering Algorithms with C
|
|
Kyle Loudon
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a
|
|
copy of this software and associated documentation files (the "Software"),
|
|
to deal in the Software without restriction, including without limitation
|
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
and/or sell copies of the Software, and to permit persons to whom the
|
|
Software is furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE, OR ANY OTHER
|
|
DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
/*****************************************************************************
|
|
* *
|
|
* -------------------------------- list.h -------------------------------- *
|
|
* *
|
|
*****************************************************************************/
|
|
|
|
#ifndef _COMMON_LIST_H
|
|
#define _COMMON_LIST_H
|
|
|
|
#include <stdlib.h>
|
|
#include <common/config.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 /* _COMMON_LIST_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|