emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/lisp.h


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/src/lisp.h
Date: Sat, 08 Apr 2006 14:15:04 +0000

Index: emacs/src/lisp.h
diff -u emacs/src/lisp.h:1.553 emacs/src/lisp.h:1.554
--- emacs/src/lisp.h:1.553      Sat Mar 11 12:33:03 2006
+++ emacs/src/lisp.h    Sat Apr  8 14:15:04 2006
@@ -702,6 +702,13 @@
     unsigned char *data;
   };
 
+#ifdef offsetof
+#define OFFSETOF(type,field) offsetof(type,field)
+#else
+#define OFFSETOF(type,field) \
+  ((int)((char*)&((type*)0)->field - (char*)0))
+#endif
+
 /* If a struct is made to look like a vector, this macro returns the length
    of the shortest vector that would hold that struct.  */
 #define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector)  \
@@ -709,6 +716,13 @@
                         + sizeof(Lisp_Object) - 1) /* round up */     \
                       / sizeof (Lisp_Object))
 
+/* Like VECSIZE, but used when the pseudo-vector has non-Lisp_Object fields
+   at the end and we need to compute the number of Lisp_Object fields (the
+   ones that the GC needs to trace).  */
+#define PSEUDOVECSIZE(type, nonlispfield) \
+  ((offsetof(type, nonlispfield) - offsetof(struct Lisp_Vector, contents[0])) \
+   / sizeof (Lisp_Object))
+
 struct Lisp_Vector
   {
     EMACS_INT size;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]