aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2014-05-24 22:19:27 +0300
committerEli Zaretskii2014-05-24 22:19:27 +0300
commit376f53c54402c014da37c29cfd1c8ebf8e392d3c (patch)
treefc3009c43ce5426f56ea4d6cf7e19e484a9e745a
parent791dd8e75bf03e9910409e9b6f6f70c37aa42332 (diff)
downloademacs-376f53c54402c014da37c29cfd1c8ebf8e392d3c.tar.gz
emacs-376f53c54402c014da37c29cfd1c8ebf8e392d3c.zip
Fix last commits in xdisp.c, which caused a crash at startup on w32.
src/xdisp.c (safe__call): Accept va_list argument instead of '...'. (safe_call, safe__call1): Construct a va_list argument for safe_call. (safe_call1): Call safe_call instead of safe__call directly. Fixes: debbugs:17577
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xdisp.c25
2 files changed, 23 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f7747c1e408..2bce5e71df8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12014-05-24 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (safe__call): Accept va_list argument instead of '...'.
4 (safe_call, safe__call1): Construct a va_list argument for safe_call.
5 (safe_call1): Call safe_call instead of safe__call directly.
6
12014-05-24 Ken Brown <kbrown@cornell.edu> 72014-05-24 Ken Brown <kbrown@cornell.edu>
2 8
3 * w32term.c (x_delete_display) [CYGWIN]: Don't free 9 * w32term.c (x_delete_display) [CYGWIN]: Don't free
diff --git a/src/xdisp.c b/src/xdisp.c
index 8c9884c3925..7407390d4f4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2592,7 +2592,7 @@ safe_eval_handler (Lisp_Object arg, ptrdiff_t nargs, Lisp_Object *args)
2592 wrong. Prevent redisplay during the evaluation. */ 2592 wrong. Prevent redisplay during the evaluation. */
2593 2593
2594static Lisp_Object 2594static Lisp_Object
2595safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, ...) 2595safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, va_list ap)
2596{ 2596{
2597 Lisp_Object val; 2597 Lisp_Object val;
2598 2598
@@ -2600,17 +2600,14 @@ safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, ...)
2600 val = Qnil; 2600 val = Qnil;
2601 else 2601 else
2602 { 2602 {
2603 va_list ap;
2604 ptrdiff_t i; 2603 ptrdiff_t i;
2605 ptrdiff_t count = SPECPDL_INDEX (); 2604 ptrdiff_t count = SPECPDL_INDEX ();
2606 struct gcpro gcpro1; 2605 struct gcpro gcpro1;
2607 Lisp_Object *args = alloca (nargs * word_size); 2606 Lisp_Object *args = alloca (nargs * word_size);
2608 2607
2609 args[0] = func; 2608 args[0] = func;
2610 va_start (ap, func);
2611 for (i = 1; i < nargs; i++) 2609 for (i = 1; i < nargs; i++)
2612 args[i] = va_arg (ap, Lisp_Object); 2610 args[i] = va_arg (ap, Lisp_Object);
2613 va_end (ap);
2614 2611
2615 GCPRO1 (args[0]); 2612 GCPRO1 (args[0]);
2616 gcpro1.nvars = nargs; 2613 gcpro1.nvars = nargs;
@@ -2631,7 +2628,13 @@ safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, ...)
2631Lisp_Object 2628Lisp_Object
2632safe_call (ptrdiff_t nargs, Lisp_Object func, ...) 2629safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2633{ 2630{
2634 return safe__call (false, nargs, func); 2631 Lisp_Object retval;
2632 va_list ap;
2633
2634 va_start (ap, func);
2635 retval = safe__call (false, nargs, func, ap);
2636 va_end (ap);
2637 return retval;
2635} 2638}
2636 2639
2637/* Call function FN with one argument ARG. 2640/* Call function FN with one argument ARG.
@@ -2640,13 +2643,19 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2640Lisp_Object 2643Lisp_Object
2641safe_call1 (Lisp_Object fn, Lisp_Object arg) 2644safe_call1 (Lisp_Object fn, Lisp_Object arg)
2642{ 2645{
2643 return safe__call (false, 2, fn, arg); 2646 return safe_call (2, fn, arg);
2644} 2647}
2645 2648
2646Lisp_Object 2649Lisp_Object
2647safe__call1 (bool inhibit_quit, Lisp_Object fn, Lisp_Object arg) 2650safe__call1 (bool inhibit_quit, Lisp_Object fn, ...)
2648{ 2651{
2649 return safe__call (inhibit_quit, 2, fn, arg); 2652 Lisp_Object retval;
2653 va_list ap;
2654
2655 va_start (ap, fn);
2656 retval = safe__call (inhibit_quit, 2, fn, ap);
2657 va_end (ap);
2658 return retval;
2650} 2659}
2651 2660
2652static Lisp_Object Qeval; 2661static Lisp_Object Qeval;