]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Add SLIST support for libc not shipping it (like Sarge)
authorVincent Bernat <vbernat@wanadooportails.com>
Fri, 12 Dec 2008 09:55:42 +0000 (10:55 +0100)
committerVincent Bernat <vbernat@wanadooportails.com>
Fri, 12 Dec 2008 09:55:42 +0000 (10:55 +0100)
configure.ac
src/compat.h

index c723c10fa9563a451f4e8f1702bca69e9f5d1e32..ad354037de402c7424230f1f6a22cf6e7c9d2d4f 100644 (file)
@@ -40,6 +40,8 @@ AC_ARG_WITH(privsep-chroot,
 
 # Checks for header files.
 AC_CHECK_DECLS([TAILQ_FIRST, TAILQ_NEXT, TAILQ_FOREACH, TAILQ_EMPTY],[],[],[[#include <sys/queue.h>]])
+AC_CHECK_DECLS([SLIST_HEAD, SLIST_ENTRY, SLIST_INIT, SLIST_INSERT_HEAD],[],[],[[#include <sys/queue.h>]])
+AC_CHECK_DECLS([SLIST_FIRST, SLIST_NEXT, SLIST_REMOVE_HEAD, SLIST_EMPTY],[],[],[[#include <sys/queue.h>]])
 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[#include <linux/if_packet.h>]])
 AC_CHECK_DECLS([ADVERTISED_2500baseX_Full, ADVERTISED_Pause, ADVERTISED_Asym_Pause],
                                           [],[],[[#include <linux/ethtool.h>]])
index 2123563714ac03c2a0ec6b75205e03a9f020ea3f..ac649d30b4ce330e5a88d980aac4c547f68d1f95 100644 (file)
 #define        TAILQ_EMPTY(head)               ((head)->tqh_first == NULL)
 #endif
 
+#if !HAVE_DECL_SLIST_HEAD
+#define        SLIST_HEAD(name, type)                                          \
+struct name {                                                          \
+       struct type *slh_first; /* first element */                     \
+}
+#endif
+
+#if !HAVE_DECL_SLIST_ENTRY
+#define        SLIST_ENTRY(type)                                               \
+struct {                                                               \
+       struct type *sle_next;  /* next element */                      \
+}
+#endif
+
+#if !HAVE_DECL_SLIST_INIT
+#define        SLIST_INIT(head) do {                                           \
+       (head)->slh_first = NULL;                                       \
+} while (/*CONSTCOND*/0)
+#endif
+
+#if !HAVE_DECL_SLIST_INSERT_HEAD
+#define        SLIST_INSERT_HEAD(head, elm, field) do {                        \
+       (elm)->field.sle_next = (head)->slh_first;                      \
+       (head)->slh_first = (elm);                                      \
+} while (/*CONSTCOND*/0)
+#endif
+
+#if !HAVE_DECL_SLIST_REMOVE_HEAD
+#define        SLIST_REMOVE_HEAD(head, field) do {                             \
+       (head)->slh_first = (head)->slh_first->field.sle_next;          \
+} while (/*CONSTCOND*/0)
+#endif
+
+#if !HAVE_DECL_SLIST_EMPTY
+#define        SLIST_EMPTY(head)       ((head)->slh_first == NULL)
+#endif
+
+#if !HAVE_DECL_SLIST_FIRST
+#define        SLIST_FIRST(head)       ((head)->slh_first)
+#endif
+
+#if !HAVE_DECL_SLIST_NEXT
+#define        SLIST_NEXT(elm, field)  ((elm)->field.sle_next)
+#endif
+
 #if !HAVE_DECL_ADVERTISED_PAUSE
 #define ADVERTISED_Pause (1 << 13)
 #endif