diff options
| author | Dmitry Antipov | 2013-01-15 14:14:31 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-01-15 14:14:31 +0400 |
| commit | 3346c1d0a8e53bc883bf07d8c7d4fbd8d3d6a690 (patch) | |
| tree | f21145fa8837326e902cb9188027397d700baba9 /src | |
| parent | 2b30549c493d7b67fa92c2b4bcd2bd2e55210ae1 (diff) | |
| download | emacs-3346c1d0a8e53bc883bf07d8c7d4fbd8d3d6a690.tar.gz emacs-3346c1d0a8e53bc883bf07d8c7d4fbd8d3d6a690.zip | |
* 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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/fileio.c | 37 | ||||
| -rw-r--r-- | src/keymap.c | 15 | ||||
| -rw-r--r-- | src/xmenu.c | 7 |
4 files changed, 36 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 289aed36088..4574d3fe23d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,19 @@ | |||
| 1 | 2013-01-15 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-01-15 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | * keymap.c (map_keymap_internal): Use format_save_value. | ||
| 4 | (map_keymap_char_table_item): Adjust accordingly. | ||
| 5 | * fileio.c (non_regular_fd, non_regular_inserted) | ||
| 6 | (non_regular_nbytes): Remove. | ||
| 7 | (Finsert_file_contents): Convert trytry to ptrdiff_t. Use | ||
| 8 | format_save_value to pass parameters to read_non_regular. | ||
| 9 | (read_non_regular): Use XSAVE_ macros to extract parameters. | ||
| 10 | Adjust comment. | ||
| 11 | * xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Use | ||
| 12 | format_save_value. | ||
| 13 | (pop_down_menu) [!USE_X_TOOLKIT && !USE_GTK]: Adjust user. | ||
| 14 | |||
| 15 | 2013-01-15 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 16 | |||
| 3 | * lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow | 17 | * lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow |
| 4 | extraction from any Lisp_Save_Value slot. Add type checking. | 18 | extraction from any Lisp_Save_Value slot. Add type checking. |
| 5 | * alloc.c, dired.c, editfns.c, fileio.c, ftfont.c, gtkutil.c: | 19 | * alloc.c, dired.c, editfns.c, fileio.c, ftfont.c, gtkutil.c: |
diff --git a/src/fileio.c b/src/fileio.c index 8c194a56fc8..87d945c1e5e 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3408,30 +3408,22 @@ decide_coding_unwind (Lisp_Object unwind_data) | |||
| 3408 | return Qnil; | 3408 | return Qnil; |
| 3409 | } | 3409 | } |
| 3410 | 3410 | ||
| 3411 | 3411 | /* Read from a non-regular file. STATE is a Lisp_Save_Value | |
| 3412 | /* Used to pass values from insert-file-contents to read_non_regular. */ | 3412 | object where slot 0 is the file descriptor, slot 1 specifies |
| 3413 | 3413 | an offset to put the read bytes, and slot 2 is the maximum | |
| 3414 | static int non_regular_fd; | 3414 | amount of bytes to read. Value is the number of bytes read. */ |
| 3415 | static ptrdiff_t non_regular_inserted; | ||
| 3416 | static int non_regular_nbytes; | ||
| 3417 | |||
| 3418 | |||
| 3419 | /* Read from a non-regular file. | ||
| 3420 | Read non_regular_nbytes bytes max from non_regular_fd. | ||
| 3421 | Non_regular_inserted specifies where to put the read bytes. | ||
| 3422 | Value is the number of bytes read. */ | ||
| 3423 | 3415 | ||
| 3424 | static Lisp_Object | 3416 | static Lisp_Object |
| 3425 | read_non_regular (Lisp_Object ignore) | 3417 | read_non_regular (Lisp_Object state) |
| 3426 | { | 3418 | { |
| 3427 | int nbytes; | 3419 | int nbytes; |
| 3428 | 3420 | ||
| 3429 | immediate_quit = 1; | 3421 | immediate_quit = 1; |
| 3430 | QUIT; | 3422 | QUIT; |
| 3431 | nbytes = emacs_read (non_regular_fd, | 3423 | nbytes = emacs_read (XSAVE_INTEGER (state, 0), |
| 3432 | ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE | 3424 | ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE |
| 3433 | + non_regular_inserted), | 3425 | + XSAVE_INTEGER (state, 1)), |
| 3434 | non_regular_nbytes); | 3426 | XSAVE_INTEGER (state, 2)); |
| 3435 | immediate_quit = 0; | 3427 | immediate_quit = 0; |
| 3436 | return make_number (nbytes); | 3428 | return make_number (nbytes); |
| 3437 | } | 3429 | } |
| @@ -4238,7 +4230,7 @@ by calling `format-decode', which see. */) | |||
| 4238 | while (how_much < total) | 4230 | while (how_much < total) |
| 4239 | { | 4231 | { |
| 4240 | /* try is reserved in some compilers (Microsoft C) */ | 4232 | /* try is reserved in some compilers (Microsoft C) */ |
| 4241 | int trytry = min (total - how_much, READ_BUF_SIZE); | 4233 | ptrdiff_t trytry = min (total - how_much, READ_BUF_SIZE); |
| 4242 | ptrdiff_t this; | 4234 | ptrdiff_t this; |
| 4243 | 4235 | ||
| 4244 | if (not_regular) | 4236 | if (not_regular) |
| @@ -4255,12 +4247,11 @@ by calling `format-decode', which see. */) | |||
| 4255 | /* Read from the file, capturing `quit'. When an | 4247 | /* Read from the file, capturing `quit'. When an |
| 4256 | error occurs, end the loop, and arrange for a quit | 4248 | error occurs, end the loop, and arrange for a quit |
| 4257 | to be signaled after decoding the text we read. */ | 4249 | to be signaled after decoding the text we read. */ |
| 4258 | non_regular_fd = fd; | 4250 | nbytes = internal_condition_case_1 |
| 4259 | non_regular_inserted = inserted; | 4251 | (read_non_regular, |
| 4260 | non_regular_nbytes = trytry; | 4252 | format_save_value ("iii", (ptrdiff_t) fd, inserted, trytry), |
| 4261 | nbytes = internal_condition_case_1 (read_non_regular, | 4253 | Qerror, read_non_regular_quit); |
| 4262 | Qnil, Qerror, | 4254 | |
| 4263 | read_non_regular_quit); | ||
| 4264 | if (NILP (nbytes)) | 4255 | if (NILP (nbytes)) |
| 4265 | { | 4256 | { |
| 4266 | read_quit = 1; | 4257 | read_quit = 1; |
diff --git a/src/keymap.c b/src/keymap.c index f64c8d5a848..a9266120e86 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -565,14 +565,13 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val) | |||
| 565 | { | 565 | { |
| 566 | if (!NILP (val)) | 566 | if (!NILP (val)) |
| 567 | { | 567 | { |
| 568 | map_keymap_function_t fun = XSAVE_POINTER (XCAR (args), 0); | 568 | map_keymap_function_t fun = XSAVE_POINTER (args, 0); |
| 569 | args = XCDR (args); | ||
| 570 | /* If the key is a range, make a copy since map_char_table modifies | 569 | /* If the key is a range, make a copy since map_char_table modifies |
| 571 | it in place. */ | 570 | it in place. */ |
| 572 | if (CONSP (key)) | 571 | if (CONSP (key)) |
| 573 | key = Fcons (XCAR (key), XCDR (key)); | 572 | key = Fcons (XCAR (key), XCDR (key)); |
| 574 | map_keymap_item (fun, XCDR (args), key, val, | 573 | map_keymap_item (fun, XSAVE_OBJECT (args, 2), key, |
| 575 | XSAVE_POINTER (XCAR (args), 0)); | 574 | val, XSAVE_POINTER (args, 1)); |
| 576 | } | 575 | } |
| 577 | } | 576 | } |
| 578 | 577 | ||
| @@ -610,12 +609,8 @@ map_keymap_internal (Lisp_Object map, | |||
| 610 | } | 609 | } |
| 611 | } | 610 | } |
| 612 | else if (CHAR_TABLE_P (binding)) | 611 | else if (CHAR_TABLE_P (binding)) |
| 613 | { | 612 | map_char_table (map_keymap_char_table_item, Qnil, binding, |
| 614 | map_char_table (map_keymap_char_table_item, Qnil, binding, | 613 | format_save_value ("ppo", fun, data, args)); |
| 615 | Fcons (make_save_value ((void *) fun, 0), | ||
| 616 | Fcons (make_save_value (data, 0), | ||
| 617 | args))); | ||
| 618 | } | ||
| 619 | } | 614 | } |
| 620 | UNGCPRO; | 615 | UNGCPRO; |
| 621 | return tail; | 616 | return tail; |
diff --git a/src/xmenu.c b/src/xmenu.c index 56a3783127e..7f6914d26ac 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -2236,8 +2236,8 @@ menu_help_callback (char const *help_string, int pane, int item) | |||
| 2236 | static Lisp_Object | 2236 | static Lisp_Object |
| 2237 | pop_down_menu (Lisp_Object arg) | 2237 | pop_down_menu (Lisp_Object arg) |
| 2238 | { | 2238 | { |
| 2239 | FRAME_PTR f = XSAVE_POINTER (Fcar (arg), 0); | 2239 | FRAME_PTR f = XSAVE_POINTER (arg, 0); |
| 2240 | XMenu *menu = XSAVE_POINTER (Fcdr (arg), 0); | 2240 | XMenu *menu = XSAVE_POINTER (arg, 1); |
| 2241 | 2241 | ||
| 2242 | block_input (); | 2242 | block_input (); |
| 2243 | #ifndef MSDOS | 2243 | #ifndef MSDOS |
| @@ -2479,8 +2479,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps, | |||
| 2479 | #endif | 2479 | #endif |
| 2480 | 2480 | ||
| 2481 | record_unwind_protect (pop_down_menu, | 2481 | record_unwind_protect (pop_down_menu, |
| 2482 | Fcons (make_save_value (f, 0), | 2482 | format_save_value ("pp", f, menu)); |
| 2483 | make_save_value (menu, 0))); | ||
| 2484 | 2483 | ||
| 2485 | /* Help display under X won't work because XMenuActivate contains | 2484 | /* Help display under X won't work because XMenuActivate contains |
| 2486 | a loop that doesn't give Emacs a chance to process it. */ | 2485 | a loop that doesn't give Emacs a chance to process it. */ |