{
enum { size = 50 };
union specbinding *pdlvec = malloc ((size + 1) * sizeof *specpdl);
- specpdl_size = size;
specpdl = specpdl_ptr = pdlvec + 1;
+ specpdl_end = specpdl + size;
}
void
&& ! NILP (error_symbol)
/* Don't try to call a lisp function if we've already overflowed
the specpdl stack. */
- && specpdl_ptr < specpdl + specpdl_size)
+ && specpdl_ptr < specpdl_end)
{
/* Edebug takes care of restoring these variables when it exits. */
max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 20);
void
grow_specpdl_allocation (void)
{
- eassert (specpdl_ptr == specpdl + specpdl_size);
+ eassert (specpdl_ptr == specpdl_end);
specpdl_ref count = SPECPDL_INDEX ();
ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX - 1000);
union specbinding *pdlvec = specpdl - 1;
- ptrdiff_t pdlvecsize = specpdl_size + 1;
- if (max_size <= specpdl_size)
+ ptrdiff_t size = specpdl_end - specpdl;
+ ptrdiff_t pdlvecsize = size + 1;
+ if (max_size <= size)
{
if (max_specpdl_size < 400)
max_size = max_specpdl_size = 400;
- if (max_size <= specpdl_size)
+ if (max_size <= size)
xsignal0 (Qexcessive_variable_binding);
}
pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl);
specpdl = pdlvec + 1;
- specpdl_size = pdlvecsize - 1;
+ specpdl_end = specpdl + pdlvecsize - 1;
specpdl_ptr = specpdl_ref_to_ptr (count);
}
bool old_message_p = 0;
struct auto_save_unwind auto_save_unwind;
- intmax_t sum = INT_ADD_WRAPV (specpdl_size, 40, &sum) ? INTMAX_MAX : sum;
+ intmax_t sum = INT_ADD_WRAPV (specpdl_end - specpdl, 40, &sum)
+ ? INTMAX_MAX : sum;
if (max_specpdl_size < sum)
max_specpdl_size = sum;
grow_specpdl (void)
{
specpdl_ptr++;
- if (specpdl_ptr == specpdl + specpdl_size)
+ if (specpdl_ptr == specpdl_end)
grow_specpdl_allocation ();
}
xfree (self->m_specpdl - 1);
self->m_specpdl = NULL;
self->m_specpdl_ptr = NULL;
- self->m_specpdl_size = 0;
+ self->m_specpdl_end = NULL;
{
struct handler *c, *c_next;
/* Perhaps copy m_last_thing_searched from parent? */
new_thread->m_current_buffer = current_thread->m_current_buffer;
- new_thread->m_specpdl_size = 50;
- new_thread->m_specpdl = xmalloc ((1 + new_thread->m_specpdl_size)
- * sizeof (union specbinding));
- /* Skip the dummy entry. */
- ++new_thread->m_specpdl;
+ ptrdiff_t size = 50;
+ union specbinding *pdlvec = xmalloc ((1 + size) * sizeof (union specbinding));
+ new_thread->m_specpdl = pdlvec + 1; /* Skip the dummy entry. */
+ new_thread->m_specpdl_end = new_thread->m_specpdl + size;
new_thread->m_specpdl_ptr = new_thread->m_specpdl;
sys_cond_init (&new_thread->thread_condvar);
struct handler *m_handlerlist_sentinel;
#define handlerlist_sentinel (current_thread->m_handlerlist_sentinel)
- /* Current number of specbindings allocated in specpdl. */
- ptrdiff_t m_specpdl_size;
-#define specpdl_size (current_thread->m_specpdl_size)
-
/* Pointer to beginning of specpdl. */
union specbinding *m_specpdl;
#define specpdl (current_thread->m_specpdl)
+ /* End of specpld (just beyond the last element). */
+ union specbinding *m_specpdl_end;
+#define specpdl_end (current_thread->m_specpdl_end)
+
/* Pointer to first unused element in specpdl. */
union specbinding *m_specpdl_ptr;
#define specpdl_ptr (current_thread->m_specpdl_ptr)