mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-29 22:40:34 +02:00
%null-pointer properly aligned
* libguile/foreign.c: Allocate %null-pointer on the heap, to assure proper alignment.
This commit is contained in:
parent
bdf7759c2b
commit
3e5ea35c2f
1 changed files with 5 additions and 7 deletions
|
@ -55,11 +55,7 @@ SCM_SYMBOL (sym_null, "%null-pointer");
|
||||||
SCM_SYMBOL (sym_null_pointer_error, "null-pointer-error");
|
SCM_SYMBOL (sym_null_pointer_error, "null-pointer-error");
|
||||||
|
|
||||||
/* The cell representing the null pointer. */
|
/* The cell representing the null pointer. */
|
||||||
static const scm_t_bits null_pointer[2] =
|
static SCM null_pointer;
|
||||||
{
|
|
||||||
scm_tc7_foreign | (SCM_FOREIGN_TYPE_VOID << 8UL),
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Raise a null pointer dereference error. */
|
/* Raise a null pointer dereference error. */
|
||||||
static void
|
static void
|
||||||
|
@ -172,7 +168,7 @@ SCM_DEFINE (scm_foreign_set_x, "foreign-set!", 2, 0, 0,
|
||||||
|
|
||||||
SCM_VALIDATE_FOREIGN (1, foreign);
|
SCM_VALIDATE_FOREIGN (1, foreign);
|
||||||
|
|
||||||
if (SCM_UNLIKELY (scm_is_eq (foreign, PTR2SCM (&null_pointer))))
|
if (SCM_UNLIKELY (scm_is_eq (foreign, null_pointer)))
|
||||||
/* Attempting to modify the pointer value of NULL_POINTER (which is
|
/* Attempting to modify the pointer value of NULL_POINTER (which is
|
||||||
read-only anyway), so raise an error. */
|
read-only anyway), so raise an error. */
|
||||||
null_pointer_error (FUNC_NAME);
|
null_pointer_error (FUNC_NAME);
|
||||||
|
@ -1095,7 +1091,9 @@ scm_init_foreign (void)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
scm_define (sym_null, PTR2SCM (&null_pointer));
|
null_pointer = scm_cell (scm_tc7_foreign | (SCM_FOREIGN_TYPE_VOID << 8UL),
|
||||||
|
0);
|
||||||
|
scm_define (sym_null, null_pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue