aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/configure.ac7
-rw-r--r--xorg-server/include/dix-config.h.in3
-rw-r--r--xorg-server/include/list.h21
-rw-r--r--xorg-server/test/list.c4
4 files changed, 26 insertions, 9 deletions
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index abfe72766..ac3bf26f1 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -26,9 +26,9 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.12.99.905, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-08-21"
-RELEASE_NAME="Splashing Orca"
+AC_INIT([xorg-server], 1.13.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-09-05"
+RELEASE_NAME="Iced Tea"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
@@ -137,6 +137,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
+AC_C_TYPEOF
AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
AC_CHECK_SIZEOF([unsigned long])
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index 77681a953..578f249b3 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -423,6 +423,9 @@
/* Define to 64-bit byteswap macro */
#undef bswap_64
+/* Define to 1 if typeof works with your compiler. */
+#undef HAVE_TYPEOF
+
/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */
#undef TLS
diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h
index d54a207b1..2d48a8646 100644
--- a/xorg-server/include/list.h
+++ b/xorg-server/include/list.h
@@ -26,6 +26,8 @@
#ifndef _XORG_LIST_H_
#define _XORG_LIST_H_
+#include <stddef.h> /* offsetof() */
+
/**
* @file Classic doubly-link circular list implementation.
* For real usage examples of the linked list, see the file test/list.c
@@ -232,7 +234,7 @@ xorg_list_is_empty(struct xorg_list *head)
*/
#ifndef container_of
#define container_of(ptr, type, member) \
- (type *)((char *)(ptr) - (char *) &((type *)0)->member)
+ (type *)((char *)(ptr) - offsetof(type, member))
#endif
/**
@@ -271,9 +273,20 @@ xorg_list_is_empty(struct xorg_list *head)
#define xorg_list_last_entry(ptr, type, member) \
xorg_list_entry((ptr)->prev, type, member)
-#define __container_of(ptr, sample, member) \
- (void *)((char *)(ptr) \
- - ((char *)&(sample)->member - (char *)(sample)))
+#ifdef HAVE_TYPEOF
+#define __container_of(ptr, sample, member) \
+ container_of(ptr, typeof(*sample), member)
+#else
+/* This implementation of __container_of has undefined behavior according
+ * to the C standard, but it works in many cases. If your compiler doesn't
+ * support typeof() and fails with this implementation, please try a newer
+ * compiler.
+ */
+#define __container_of(ptr, sample, member) \
+ (void *)((char *)(ptr) \
+ - ((char *)&(sample)->member - (char *)(sample)))
+#endif
+
/**
* Loop through the list given by head and set pos to struct in the list.
*
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index 82d232706..f9f54ee4e 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -137,7 +137,7 @@ static void
test_xorg_list_del(void)
{
struct parent parent = { 0 };
- struct child child[3];
+ struct child child[2];
struct child *c;
xorg_list_init(&parent.children);
@@ -178,8 +178,8 @@ test_xorg_list_del(void)
xorg_list_add(&child[0].node, &parent.children);
xorg_list_del(&parent.children);
assert(xorg_list_is_empty(&parent.children));
+ assert(!xorg_list_is_empty(&child[0].node));
assert(!xorg_list_is_empty(&child[1].node));
- assert(!xorg_list_is_empty(&child[2].node));
}
static void