summaryrefslogtreecommitdiff
path: root/extra/cvsps/use-offsetof-macro.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extra/cvsps/use-offsetof-macro.patch')
-rw-r--r--extra/cvsps/use-offsetof-macro.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/extra/cvsps/use-offsetof-macro.patch b/extra/cvsps/use-offsetof-macro.patch
new file mode 100644
index 000000000..ff2961f07
--- /dev/null
+++ b/extra/cvsps/use-offsetof-macro.patch
@@ -0,0 +1,32 @@
+From 4fad63b82746ea571edc2ec1100ad3208cf5af08 Mon Sep 17 00:00:00 2001
+From: Eric Hopper <hopper@omnifarious.org>
+Date: Fri, 29 Jun 2007 01:30:09 -0700
+Subject: [PATCH] Use offsetof macro instead of unportable pointer arithmetic.
+
+---
+ cbtcommon/list.h | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/cbtcommon/list.h b/cbtcommon/list.h
+index 4ee245d..cf4b3ed 100644
+--- a/cbtcommon/list.h
++++ b/cbtcommon/list.h
+@@ -23,6 +23,7 @@
+ */
+
+ #include "inline.h"
++#include <stddef.h>
+
+ struct list_head {
+ struct list_head *next, *prev;
+@@ -107,6 +108,6 @@ static INLINE void list_splice(struct list_head *list, struct list_head *head)
+ }
+
+ #define list_entry(ptr, type, member) \
+- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
++ ((type *)((char *)(ptr)-offsetof(type, member)))
+
+ #endif /* _COMMON_LIST_H */
+--
+1.6.5.GIT
+