aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorPaul Eggert2019-04-01 11:54:23 -0700
committerPaul Eggert2019-04-01 12:02:37 -0700
commit9287813da1ae9076f29be111674d1795bee66447 (patch)
treed48781deb3ccc24f40de2944efdccc6a84280fd5 /src/buffer.c
parent197fbfc71f49b307baa3831a30732c3a0c4c7420 (diff)
downloademacs-9287813da1ae9076f29be111674d1795bee66447.tar.gz
emacs-9287813da1ae9076f29be111674d1795bee66447.zip
Fix union Lisp_Fwd * alignment bug
It's not portable to cast (e.g.) struct Lisp_Objfwd * to union Lisp_Fwd * and then back again, because the compiler can then assume that the pointer is aligned for union Lisp_Fwd * when accessing the struct Lisp_Objfwd * components, and this assumption might be incorrect becase we don't force that alignment. * src/lisp.h (lispfwd): New type, replacing ... (union Lisp_Fwd): ... this type, which was removed. All uses changed. (SET_SYMBOL_FWD): 2nd arg is now void *, not lispfwd. All uses changed (casts no longer needed; they were not portable anyway).
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 7c4691e52c0..c0f7521c9e1 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1207,7 +1207,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer)
1207 result = Fassoc (variable, BVAR (buf, local_var_alist), Qnil); 1207 result = Fassoc (variable, BVAR (buf, local_var_alist), Qnil);
1208 if (!NILP (result)) 1208 if (!NILP (result))
1209 { 1209 {
1210 if (blv->fwd) 1210 if (blv->fwd.fwdptr)
1211 { /* What binding is loaded right now? */ 1211 { /* What binding is loaded right now? */
1212 Lisp_Object current_alist_element = blv->valcell; 1212 Lisp_Object current_alist_element = blv->valcell;
1213 1213
@@ -1228,7 +1228,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer)
1228 } 1228 }
1229 case SYMBOL_FORWARDED: 1229 case SYMBOL_FORWARDED:
1230 { 1230 {
1231 union Lisp_Fwd *fwd = SYMBOL_FWD (sym); 1231 lispfwd fwd = SYMBOL_FWD (sym);
1232 if (BUFFER_OBJFWDP (fwd)) 1232 if (BUFFER_OBJFWDP (fwd))
1233 result = per_buffer_value (buf, XBUFFER_OBJFWD (fwd)->offset); 1233 result = per_buffer_value (buf, XBUFFER_OBJFWD (fwd)->offset);
1234 else 1234 else
@@ -2140,7 +2140,7 @@ void set_buffer_internal_2 (register struct buffer *b)
2140 Lisp_Object var = XCAR (XCAR (tail)); 2140 Lisp_Object var = XCAR (XCAR (tail));
2141 struct Lisp_Symbol *sym = XSYMBOL (var); 2141 struct Lisp_Symbol *sym = XSYMBOL (var);
2142 if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */ 2142 if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */
2143 && SYMBOL_BLV (sym)->fwd) 2143 && SYMBOL_BLV (sym)->fwd.fwdptr)
2144 /* Just reference the variable 2144 /* Just reference the variable
2145 to cause it to become set for this buffer. */ 2145 to cause it to become set for this buffer. */
2146 Fsymbol_value (var); 2146 Fsymbol_value (var);
@@ -5444,7 +5444,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5444 bo_fwd->predicate = predicate; 5444 bo_fwd->predicate = predicate;
5445 sym->u.s.declared_special = true; 5445 sym->u.s.declared_special = true;
5446 sym->u.s.redirect = SYMBOL_FORWARDED; 5446 sym->u.s.redirect = SYMBOL_FORWARDED;
5447 SET_SYMBOL_FWD (sym, (union Lisp_Fwd *) bo_fwd); 5447 SET_SYMBOL_FWD (sym, bo_fwd);
5448 XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym); 5448 XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym);
5449 5449
5450 if (PER_BUFFER_IDX (offset) == 0) 5450 if (PER_BUFFER_IDX (offset) == 0)