[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109290: Convert safe_call to use var
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109290: Convert safe_call to use variable number of arguments. |
Date: |
Mon, 30 Jul 2012 10:43:46 +0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109290
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Mon 2012-07-30 10:43:46 +0400
message:
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.
modified:
src/ChangeLog
src/coding.c
src/composite.c
src/keyboard.c
src/lisp.h
src/term.c
src/xdisp.c
src/xfaces.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-30 06:34:22 +0000
+++ b/src/ChangeLog 2012-07-30 06:43:46 +0000
@@ -1,3 +1,12 @@
+2012-07-30 Dmitry Antipov <address@hidden>
+
+ 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 <address@hidden>
* s/aix4-2.h (sigmask): No need to undefine it, since syssignal.h
=== modified file 'src/coding.c'
--- a/src/coding.c 2012-07-27 09:24:34 +0000
+++ b/src/coding.c 2012-07-30 06:43:46 +0000
@@ -7931,15 +7931,12 @@
}
{
- 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)
=== modified file 'src/composite.c'
--- a/src/composite.c 2012-07-06 05:07:44 +0000
+++ b/src/composite.c 2012-07-30 06:43:46 +0000
@@ -947,20 +947,12 @@
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);
}
=== modified file 'src/keyboard.c'
--- a/src/keyboard.c 2012-07-26 01:27:33 +0000
+++ b/src/keyboard.c 2012-07-30 06:43:46 +0000
@@ -2185,14 +2185,7 @@
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);
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-07-30 05:41:10 +0000
+++ b/src/lisp.h 2012-07-30 06:43:46 +0000
@@ -2842,7 +2842,7 @@
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);
=== modified file 'src/term.c'
--- a/src/term.c 2012-07-08 16:38:43 +0000
+++ b/src/term.c 2012-07-30 06:43:46 +0000
@@ -2209,11 +2209,10 @@
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"));
}
}
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2012-07-28 07:59:34 +0000
+++ b/src/xdisp.c 2012-07-30 06:43:46 +0000
@@ -2403,16 +2403,12 @@
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 @@
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 @@
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 @@
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);
}
=== modified file 'src/xfaces.c'
--- a/src/xfaces.c 2012-07-10 08:43:46 +0000
+++ b/src/xfaces.c 2012-07-30 06:43:46 +0000
@@ -2254,11 +2254,7 @@
{
/* 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))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109290: Convert safe_call to use variable number of arguments.,
Dmitry Antipov <=