Convert safe_call to use variable number of arguments.
* xdisp.c (safe_call): Convert to use varargs. Adjust users. (safe_call2): Fix comment. * lisp.h (safe_call): Adjust prototype. * coding.c (encode_coding_object): Change to use safe_call2. * xfaces.c (merge_face_heights): Change to use safe_call1.
This commit is contained in:
parent
227f5bd0b4
commit
6cd7a13902
8 changed files with 32 additions and 48 deletions
|
@ -1,3 +1,12 @@
|
|||
2012-07-30 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Convert safe_call to use variable number of arguments.
|
||||
* xdisp.c (safe_call): Convert to use varargs. Adjust users.
|
||||
(safe_call2): Fix comment.
|
||||
* lisp.h (safe_call): Adjust prototype.
|
||||
* coding.c (encode_coding_object): Change to use safe_call2.
|
||||
* xfaces.c (merge_face_heights): Change to use safe_call1.
|
||||
|
||||
2012-07-30 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* s/aix4-2.h (sigmask): No need to undefine it, since syssignal.h
|
||||
|
|
|
@ -7931,15 +7931,12 @@ encode_coding_object (struct coding_system *coding,
|
|||
}
|
||||
|
||||
{
|
||||
Lisp_Object args[3];
|
||||
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
|
||||
|
||||
GCPRO5 (coding->src_object, coding->dst_object, src_object, dst_object,
|
||||
old_deactivate_mark);
|
||||
args[0] = CODING_ATTR_PRE_WRITE (attrs);
|
||||
args[1] = make_number (BEG);
|
||||
args[2] = make_number (Z);
|
||||
safe_call (3, args);
|
||||
safe_call2 (CODING_ATTR_PRE_WRITE (attrs),
|
||||
make_number (BEG), make_number (Z));
|
||||
UNGCPRO;
|
||||
}
|
||||
if (XBUFFER (coding->src_object) != current_buffer)
|
||||
|
|
|
@ -947,20 +947,12 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t
|
|||
string);
|
||||
if (NILP (LGSTRING_ID (lgstring)))
|
||||
{
|
||||
Lisp_Object args[6];
|
||||
|
||||
/* Save point as marker before calling out to lisp. */
|
||||
if (NILP (string))
|
||||
record_unwind_protect (restore_point_unwind,
|
||||
build_marker (current_buffer, pt, pt_byte));
|
||||
|
||||
args[0] = Vauto_composition_function;
|
||||
args[1] = AREF (rule, 2);
|
||||
args[2] = pos;
|
||||
args[3] = make_number (to);
|
||||
args[4] = font_object;
|
||||
args[5] = string;
|
||||
lgstring = safe_call (6, args);
|
||||
lgstring = safe_call (6, Vauto_composition_function, AREF (rule, 2),
|
||||
pos, make_number (to), font_object, string);
|
||||
}
|
||||
return unbind_to (count, lgstring);
|
||||
}
|
||||
|
|
|
@ -2185,14 +2185,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
|
|||
if (!NILP (help) && !STRINGP (help))
|
||||
{
|
||||
if (FUNCTIONP (help))
|
||||
{
|
||||
Lisp_Object args[4];
|
||||
args[0] = help;
|
||||
args[1] = window;
|
||||
args[2] = object;
|
||||
args[3] = pos;
|
||||
help = safe_call (4, args);
|
||||
}
|
||||
help = safe_call (4, help, window, object, pos);
|
||||
else
|
||||
help = safe_eval (help);
|
||||
|
||||
|
|
|
@ -2842,7 +2842,7 @@ extern _Noreturn void verror (const char *, va_list)
|
|||
ATTRIBUTE_FORMAT_PRINTF (1, 0);
|
||||
extern Lisp_Object un_autoload (Lisp_Object);
|
||||
extern void init_eval_once (void);
|
||||
extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object *);
|
||||
extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...);
|
||||
extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
|
||||
extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
|
||||
extern void init_eval (void);
|
||||
|
|
|
@ -2209,11 +2209,10 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f)
|
|||
|
||||
if (mode != tty->previous_color_mode)
|
||||
{
|
||||
Lisp_Object funsym = intern ("tty-set-up-initial-frame-faces");
|
||||
tty->previous_color_mode = mode;
|
||||
tty_setup_colors (tty , mode);
|
||||
/* This recomputes all the faces given the new color definitions. */
|
||||
safe_call (1, &funsym);
|
||||
safe_call (1, intern ("tty-set-up-initial-frame-faces"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
32
src/xdisp.c
32
src/xdisp.c
|
@ -2403,16 +2403,12 @@ safe_eval_handler (Lisp_Object arg)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
|
||||
/* Evaluate SEXPR and return the result, or nil if something went
|
||||
/* Call function FUNC with the rest of NARGS - 1 arguments
|
||||
following. Return the result, or nil if something went
|
||||
wrong. Prevent redisplay during the evaluation. */
|
||||
|
||||
/* Call function ARGS[0] with arguments ARGS[1] to ARGS[NARGS - 1].
|
||||
Return the result, or nil if something went wrong. Prevent
|
||||
redisplay during the evaluation. */
|
||||
|
||||
Lisp_Object
|
||||
safe_call (ptrdiff_t nargs, Lisp_Object *args)
|
||||
safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
|
||||
{
|
||||
Lisp_Object val;
|
||||
|
||||
|
@ -2420,8 +2416,17 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args)
|
|||
val = Qnil;
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
ptrdiff_t i;
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
struct gcpro gcpro1;
|
||||
Lisp_Object *args = alloca (nargs * sizeof (Lisp_Object));
|
||||
|
||||
args[0] = func;
|
||||
va_start (ap, func);
|
||||
for (i = 1; i < nargs; i++)
|
||||
args[i] = va_arg (ap, Lisp_Object);
|
||||
va_end (ap);
|
||||
|
||||
GCPRO1 (args[0]);
|
||||
gcpro1.nvars = nargs;
|
||||
|
@ -2444,10 +2449,7 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args)
|
|||
Lisp_Object
|
||||
safe_call1 (Lisp_Object fn, Lisp_Object arg)
|
||||
{
|
||||
Lisp_Object args[2];
|
||||
args[0] = fn;
|
||||
args[1] = arg;
|
||||
return safe_call (2, args);
|
||||
return safe_call (2, fn, arg);
|
||||
}
|
||||
|
||||
static Lisp_Object Qeval;
|
||||
|
@ -2458,17 +2460,13 @@ safe_eval (Lisp_Object sexpr)
|
|||
return safe_call1 (Qeval, sexpr);
|
||||
}
|
||||
|
||||
/* Call function FN with one argument ARG.
|
||||
/* Call function FN with two arguments ARG1 and ARG2.
|
||||
Return the result, or nil if something went wrong. */
|
||||
|
||||
Lisp_Object
|
||||
safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
|
||||
{
|
||||
Lisp_Object args[3];
|
||||
args[0] = fn;
|
||||
args[1] = arg1;
|
||||
args[2] = arg2;
|
||||
return safe_call (3, args);
|
||||
return safe_call (3, fn, arg1, arg2);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2254,11 +2254,7 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
|
|||
{
|
||||
/* Call function with current height as argument.
|
||||
From is the new height. */
|
||||
Lisp_Object args[2];
|
||||
|
||||
args[0] = from;
|
||||
args[1] = to;
|
||||
result = safe_call (2, args);
|
||||
result = safe_call1 (from, to);
|
||||
|
||||
/* Ensure that if TO was absolute, so is the result. */
|
||||
if (INTEGERP (to) && !INTEGERP (result))
|
||||
|
|
Loading…
Add table
Reference in a new issue