summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-07-21 12:31:51 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-07-21 12:32:16 -0700
commit5d4dd552c29279b8a9e6ed269a2dc3afc36f73b9 (patch)
tree95edeff83e756072c35f974f6271ba8c191d8436 /src/eval.c
parentd02c2f7f6507105605ed0596a7e26acd5b3b8122 (diff)
downloademacs-5d4dd552c29279b8a9e6ed269a2dc3afc36f73b9.tar.gz
Fix lifetime error in previous patch
Problem reported by Pip Cet in: https://lists.gnu.org/r/emacs-devel/2019-07/msg00520.html * src/alloc.c (inhibit_garbage_collection): Use new function. (allow_garbage_collection): Accept intmax_t, not pointer. * src/eval.c (default_toplevel_binding, do_one_unbind) (backtrace_eval_unrewind, Fbacktrace__locals, mark_specpdl): Support SPECPDL_UNWIND_INTMAX. (record_unwind_protect_excursion): New function. * src/lisp.h (enum specbind_tag): New constant SPECPDL_UNWIND_INTMAX. (union specbinding): New member unwind_intmax.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index 02a6c3555a9..b890aa6f7f2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -674,6 +674,7 @@ default_toplevel_binding (Lisp_Object symbol)
case SPECPDL_UNWIND_ARRAY:
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_EXCURSION:
case SPECPDL_UNWIND_VOID:
case SPECPDL_BACKTRACE:
@@ -3395,6 +3396,15 @@ record_unwind_protect_int (void (*function) (int), int arg)
}
void
+record_unwind_protect_intmax (void (*function) (intmax_t), intmax_t arg)
+{
+ specpdl_ptr->unwind_intmax.kind = SPECPDL_UNWIND_INTMAX;
+ specpdl_ptr->unwind_intmax.func = function;
+ specpdl_ptr->unwind_intmax.arg = arg;
+ grow_specpdl ();
+}
+
+void
record_unwind_protect_excursion (void)
{
specpdl_ptr->unwind_excursion.kind = SPECPDL_UNWIND_EXCURSION;
@@ -3448,6 +3458,9 @@ do_one_unbind (union specbinding *this_binding, bool unwinding,
case SPECPDL_UNWIND_INT:
this_binding->unwind_int.func (this_binding->unwind_int.arg);
break;
+ case SPECPDL_UNWIND_INTMAX:
+ this_binding->unwind_intmax.func (this_binding->unwind_intmax.arg);
+ break;
case SPECPDL_UNWIND_VOID:
this_binding->unwind_void.func ();
break;
@@ -3784,6 +3797,7 @@ backtrace_eval_unrewind (int distance)
case SPECPDL_UNWIND_ARRAY:
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_VOID:
case SPECPDL_BACKTRACE:
break;
@@ -3917,6 +3931,7 @@ NFRAMES and BASE specify the activation frame to use, as in `backtrace-frame'.
case SPECPDL_UNWIND_ARRAY:
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_EXCURSION:
case SPECPDL_UNWIND_VOID:
case SPECPDL_BACKTRACE:
@@ -3979,6 +3994,7 @@ mark_specpdl (union specbinding *first, union specbinding *ptr)
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_VOID:
break;