emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111532: * keymap.c (map_keymap_inter


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111532: * keymap.c (map_keymap_internal): Use format_save_value.
Date: Tue, 15 Jan 2013 14:14:31 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111532
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-01-15 14:14:31 +0400
message:
  * 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.
modified:
  src/ChangeLog
  src/fileio.c
  src/keymap.c
  src/xmenu.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-01-15 09:22:25 +0000
+++ b/src/ChangeLog     2013-01-15 10:14:31 +0000
@@ -1,5 +1,19 @@
 2013-01-15  Dmitry Antipov  <address@hidden>
 
+       * 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  <address@hidden>
+
        * lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow
        extraction from any Lisp_Save_Value slot.  Add type checking.
        * alloc.c, dired.c, editfns.c, fileio.c, ftfont.c, gtkutil.c:

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2013-01-15 09:22:25 +0000
+++ b/src/fileio.c      2013-01-15 10:14:31 +0000
@@ -3408,30 +3408,22 @@
   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 @@
     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 @@
            /* 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;

=== modified file 'src/keymap.c'
--- a/src/keymap.c      2013-01-15 09:22:25 +0000
+++ b/src/keymap.c      2013-01-15 10:14:31 +0000
@@ -565,14 +565,13 @@
 {
   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 @@
            }
        }
       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;

=== modified file 'src/xmenu.c'
--- a/src/xmenu.c       2013-01-15 09:22:25 +0000
+++ b/src/xmenu.c       2013-01-15 10:14:31 +0000
@@ -2236,8 +2236,8 @@
 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 @@
 #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.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]