emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 6da3a6d 2/2: Port to strict C99 offsetof


From: Paul Eggert
Subject: [Emacs-diffs] emacs-25 6da3a6d 2/2: Port to strict C99 offsetof
Date: Fri, 18 Mar 2016 15:43:37 +0000

branch: emacs-25
commit 6da3a6dc9e3e9ac3d7bb666410926ebc4a078505
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Port to strict C99 offsetof
    
    * src/bidi.c (bidi_copy_it):
    * src/lisp.h (CHAR_TABLE_EXTRA_SLOTS):
    Use only a single identifier as the second argument of offsetof.
    Found by using clang -pedantic.
---
 src/bidi.c |    2 +-
 src/lisp.h |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/bidi.c b/src/bidi.c
index a68ffdb..c23ff95 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -532,7 +532,7 @@ bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
   /* Copy everything from the start through the active part of
      the level stack.  */
   memcpy (to, from,
-         (offsetof (struct bidi_it, level_stack[1])
+         (offsetof (struct bidi_it, level_stack) + sizeof from->level_stack[0]
           + from->stack_idx * sizeof from->level_stack[0]));
 }
 
diff --git a/src/lisp.h b/src/lisp.h
index 2758884..6a98adb 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1766,7 +1766,8 @@ CHAR_TABLE_EXTRA_SLOTS (struct Lisp_Char_Table *ct)
 
 /* Make sure that sub char-table contents slot is where we think it is.  */
 verify (offsetof (struct Lisp_Sub_Char_Table, contents)
-       == offsetof (struct Lisp_Vector, contents[SUB_CHAR_TABLE_OFFSET]));
+       == (offsetof (struct Lisp_Vector, contents)
+           + SUB_CHAR_TABLE_OFFSET * sizeof (Lisp_Object)));
 
 /***********************************************************************
                               Symbols



reply via email to

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