* keymap.c (map_keymap_internal): Use format_save_value.

(map_keymap_char_table_item): Adjust accordingly.
* fileio.c (non_regular_fd, non_regular_inserted)
(non_regular_nbytes): Remove.
(Finsert_file_contents): Convert trytry to ptrdiff_t.  Use
format_save_value to pass parameters to read_non_regular.
(read_non_regular): Use XSAVE_ macros to extract parameters.
Adjust comment.
* xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Use
format_save_value.
(pop_down_menu) [!USE_X_TOOLKIT && !USE_GTK]: Adjust user.
This commit is contained in:
Dmitry Antipov 2013-01-15 14:14:31 +04:00
parent 2b30549c49
commit 3346c1d0a8
4 changed files with 36 additions and 37 deletions

View file

@ -1,3 +1,17 @@
2013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
* keymap.c (map_keymap_internal): Use format_save_value.
(map_keymap_char_table_item): Adjust accordingly.
* fileio.c (non_regular_fd, non_regular_inserted)
(non_regular_nbytes): Remove.
(Finsert_file_contents): Convert trytry to ptrdiff_t. Use
format_save_value to pass parameters to read_non_regular.
(read_non_regular): Use XSAVE_ macros to extract parameters.
Adjust comment.
* xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Use
format_save_value.
(pop_down_menu) [!USE_X_TOOLKIT && !USE_GTK]: Adjust user.
2013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
* lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow

View file

@ -3408,30 +3408,22 @@ decide_coding_unwind (Lisp_Object unwind_data)
return Qnil;
}
/* Used to pass values from insert-file-contents to read_non_regular. */
static int non_regular_fd;
static ptrdiff_t non_regular_inserted;
static int non_regular_nbytes;
/* Read from a non-regular file.
Read non_regular_nbytes bytes max from non_regular_fd.
Non_regular_inserted specifies where to put the read bytes.
Value is the number of bytes read. */
/* Read from a non-regular file. STATE is a Lisp_Save_Value
object where slot 0 is the file descriptor, slot 1 specifies
an offset to put the read bytes, and slot 2 is the maximum
amount of bytes to read. Value is the number of bytes read. */
static Lisp_Object
read_non_regular (Lisp_Object ignore)
read_non_regular (Lisp_Object state)
{
int nbytes;
immediate_quit = 1;
QUIT;
nbytes = emacs_read (non_regular_fd,
nbytes = emacs_read (XSAVE_INTEGER (state, 0),
((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
+ non_regular_inserted),
non_regular_nbytes);
+ XSAVE_INTEGER (state, 1)),
XSAVE_INTEGER (state, 2));
immediate_quit = 0;
return make_number (nbytes);
}
@ -4238,7 +4230,7 @@ by calling `format-decode', which see. */)
while (how_much < total)
{
/* try is reserved in some compilers (Microsoft C) */
int trytry = min (total - how_much, READ_BUF_SIZE);
ptrdiff_t trytry = min (total - how_much, READ_BUF_SIZE);
ptrdiff_t this;
if (not_regular)
@ -4255,12 +4247,11 @@ by calling `format-decode', which see. */)
/* Read from the file, capturing `quit'. When an
error occurs, end the loop, and arrange for a quit
to be signaled after decoding the text we read. */
non_regular_fd = fd;
non_regular_inserted = inserted;
non_regular_nbytes = trytry;
nbytes = internal_condition_case_1 (read_non_regular,
Qnil, Qerror,
read_non_regular_quit);
nbytes = internal_condition_case_1
(read_non_regular,
format_save_value ("iii", (ptrdiff_t) fd, inserted, trytry),
Qerror, read_non_regular_quit);
if (NILP (nbytes))
{
read_quit = 1;

View file

@ -565,14 +565,13 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val)
{
if (!NILP (val))
{
map_keymap_function_t fun = XSAVE_POINTER (XCAR (args), 0);
args = XCDR (args);
map_keymap_function_t fun = XSAVE_POINTER (args, 0);
/* If the key is a range, make a copy since map_char_table modifies
it in place. */
if (CONSP (key))
key = Fcons (XCAR (key), XCDR (key));
map_keymap_item (fun, XCDR (args), key, val,
XSAVE_POINTER (XCAR (args), 0));
map_keymap_item (fun, XSAVE_OBJECT (args, 2), key,
val, XSAVE_POINTER (args, 1));
}
}
@ -610,12 +609,8 @@ map_keymap_internal (Lisp_Object map,
}
}
else if (CHAR_TABLE_P (binding))
{
map_char_table (map_keymap_char_table_item, Qnil, binding,
Fcons (make_save_value ((void *) fun, 0),
Fcons (make_save_value (data, 0),
args)));
}
map_char_table (map_keymap_char_table_item, Qnil, binding,
format_save_value ("ppo", fun, data, args));
}
UNGCPRO;
return tail;

View file

@ -2236,8 +2236,8 @@ menu_help_callback (char const *help_string, int pane, int item)
static Lisp_Object
pop_down_menu (Lisp_Object arg)
{
FRAME_PTR f = XSAVE_POINTER (Fcar (arg), 0);
XMenu *menu = XSAVE_POINTER (Fcdr (arg), 0);
FRAME_PTR f = XSAVE_POINTER (arg, 0);
XMenu *menu = XSAVE_POINTER (arg, 1);
block_input ();
#ifndef MSDOS
@ -2479,8 +2479,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
#endif
record_unwind_protect (pop_down_menu,
Fcons (make_save_value (f, 0),
make_save_value (menu, 0)));
format_save_value ("pp", f, menu));
/* Help display under X won't work because XMenuActivate contains
a loop that doesn't give Emacs a chance to process it. */