* 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 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
}
{
- 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)
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);
}
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);
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);
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"));
}
}
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;
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;
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;
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);
}
{
/* 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))