Sha256: dc3b27cdcdafeae569a9e7e5a819d9768c11c045287282b18caa2797ced4676e

Contents?: true

Size: 1.46 KB

Versions: 136

Compression:

Stored size: 1.46 KB

Contents

/*
 * Copyright (c) 2004-2005 Sergey Lyubka <valenok@gmail.com>
 * All rights reserved
 *
 * "THE BEER-WARE LICENSE" (Revision 42):
 * Sergey Lyubka wrote this file.  As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return.
 */

#ifndef LLIST_HEADER_INCLUDED
#define	LLIST_HEADER_INCLUDED

/*
 * Linked list macros.
 */
struct llhead {
	struct llhead	*prev;
	struct llhead	*next;
};

#define	LL_INIT(N)	((N)->next = (N)->prev = (N))

#define LL_HEAD(H)	struct llhead H = { &H, &H }

#define LL_ENTRY(P,T,N) ((T *)((char *)(P) - offsetof(T, N)))

#define	LL_ADD(H, N)							\
	do {								\
		((H)->next)->prev = (N);				\
		(N)->next = ((H)->next);				\
		(N)->prev = (H);					\
		(H)->next = (N);					\
	} while (0)

#define	LL_TAIL(H, N)							\
	do {								\
		((H)->prev)->next = (N);				\
		(N)->prev = ((H)->prev);				\
		(N)->next = (H);					\
		(H)->prev = (N);					\
	} while (0)

#define	LL_DEL(N)							\
	do {								\
		((N)->next)->prev = ((N)->prev);			\
		((N)->prev)->next = ((N)->next);			\
		LL_INIT(N);						\
	} while (0)

#define	LL_EMPTY(N)	((N)->next == (N))

#define	LL_FOREACH(H,N)	for (N = (H)->next; N != (H); N = (N)->next)

#define LL_FOREACH_SAFE(H,N,T)						\
	for (N = (H)->next, T = (N)->next; N != (H);			\
			N = (T), T = (N)->next)

void free_list(struct llhead *head, void (*dtor)(struct llhead *));

#endif /* LLIST_HEADER_INCLUDED */

Version data entries

136 entries across 136 versions & 2 rubygems

Version Path
rhodes-7.6.0 platform/shared/shttpd/src/llist.h
rhodes-7.5.1 platform/shared/shttpd/src/llist.h
rhodes-7.4.1 platform/shared/shttpd/src/llist.h
rhodes-7.1.17 platform/shared/shttpd/src/llist.h
rhodes-6.2.0 platform/shared/shttpd/src/llist.h
rhodes-6.0.11 platform/shared/shttpd/src/llist.h
rhodes-5.5.18 platform/shared/shttpd/src/llist.h
rhodes-5.5.17 platform/shared/shttpd/src/llist.h
rhodes-5.5.15 platform/shared/shttpd/src/llist.h
rhodes-5.5.0.22 platform/shared/shttpd/src/llist.h
rhodes-5.5.2 platform/shared/shttpd/src/llist.h
rhodes-5.5.0.7 platform/shared/shttpd/src/llist.h
rhodes-5.5.0.3 platform/shared/shttpd/src/llist.h
rhodes-5.5.0 platform/shared/shttpd/src/llist.h
tauplatform-1.0.3 platform/shared/shttpd/src/llist.h
tauplatform-1.0.2 platform/shared/shttpd/src/llist.h
tauplatform-1.0.1 platform/shared/shttpd/src/llist.h
rhodes-3.5.1.12 platform/shared/shttpd/src/llist.h
rhodes-3.3.5 platform/shared/shttpd/src/llist.h
rhodes-3.4.2 platform/shared/shttpd/src/llist.h