emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117354: * fileio.c (Fread_file_name): Do not pass r


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117354: * fileio.c (Fread_file_name): Do not pass redundant args and ...
Date: Tue, 17 Jun 2014 03:14:40 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117354
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-06-17 07:14:00 +0400
message:
  * fileio.c (Fread_file_name): Do not pass redundant args and ...
  * callint.c (read_file_name): ... convert to static here.
  * lisp.h (Fread_file_name): Do not EXFUN it.
  * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ...
  (char_composable_p): ... static function.  All users changed.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/callint.c                  callint.c-20091113204419-o5vbwnq5f7feedwu-279
  src/composite.c                
composite.c-20091113204419-o5vbwnq5f7feedwu-1728
  src/fileio.c                   fileio.c-20091113204419-o5vbwnq5f7feedwu-210
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-06-16 22:38:17 +0000
+++ b/src/ChangeLog     2014-06-17 03:14:00 +0000
@@ -1,3 +1,11 @@
+2014-06-17  Dmitry Antipov  <address@hidden>
+
+       * fileio.c (Fread_file_name): Do not pass redundant args and ...
+       * callint.c (read_file_name): ... convert to static here.
+       * lisp.h (Fread_file_name): Do not EXFUN it.
+       * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ...
+       (char_composable_p): ... static function.  All users changed.
+
 2014-06-16  Paul Eggert  <address@hidden>
 
        * Makefile.in (ns-app): Fix typo that broke build on OS X.

=== modified file 'src/callint.c'
--- a/src/callint.c     2014-06-01 16:25:19 +0000
+++ b/src/callint.c     2014-06-17 03:14:00 +0000
@@ -233,6 +233,26 @@
     }
 }
 
+/* Helper function to call `read-file-name' from C.  */
+
+static Lisp_Object
+read_file_name (Lisp_Object default_filename, Lisp_Object mustmatch,
+               Lisp_Object initial, Lisp_Object predicate)
+{
+  struct gcpro gcpro1;
+  Lisp_Object args[7];
+
+  GCPRO1 (default_filename);
+  args[0] = intern ("read-file-name");
+  args[1] = callint_message;
+  args[2] = Qnil;
+  args[3] = default_filename;
+  args[4] = mustmatch;
+  args[5] = initial;
+  args[6] = predicate;
+  RETURN_UNGCPRO (Ffuncall (7, args));
+}
+
 /* BEWARE: Calling this directly from C would defeat the purpose!  */
 DEFUN ("funcall-interactively", Ffuncall_interactively, Sfuncall_interactively,
        1, MANY, 0, doc: /* Like `funcall' but marks the call as interactive.
@@ -574,25 +594,21 @@
          break;
 
        case 'D':               /* Directory name.  */
-         args[i] = Fread_file_name (callint_message, Qnil,
-                                    BVAR (current_buffer, directory), Qlambda, 
Qnil,
-                                    Qfile_directory_p);
+         args[i] = read_file_name (BVAR (current_buffer, directory), Qlambda, 
Qnil,
+                                   Qfile_directory_p);
          break;
 
        case 'f':               /* Existing file name.  */
-         args[i] = Fread_file_name (callint_message,
-                                    Qnil, Qnil, Qlambda, Qnil, Qnil);
+         args[i] = read_file_name (Qnil, Qlambda, Qnil, Qnil);
          break;
 
        case 'F':               /* Possibly nonexistent file name.  */
-         args[i] = Fread_file_name (callint_message,
-                                    Qnil, Qnil, Qnil, Qnil, Qnil);
+         args[i] = read_file_name (Qnil, Qnil, Qnil, Qnil);
          break;
 
        case 'G':               /* Possibly nonexistent file name,
                                   default to directory alone.  */
-         args[i] = Fread_file_name (callint_message,
-                                    Qnil, Qnil, Qnil, empty_unibyte_string, 
Qnil);
+         args[i] = read_file_name (Qnil, Qnil, empty_unibyte_string, Qnil);
          break;
 
        case 'i':               /* Ignore an argument -- Does not do I/O.  */

=== modified file 'src/composite.c'
--- a/src/composite.c   2014-02-13 12:16:42 +0000
+++ b/src/composite.c   2014-06-17 03:14:00 +0000
@@ -921,17 +921,18 @@
   return unbind_to (count, lgstring);
 }
 
-static Lisp_Object _work_val;
-
 /* 1 iff the character C is composable.  Characters of general
    category Z? or C? are not composable except for ZWNJ and ZWJ. */
 
-#define CHAR_COMPOSABLE_P(C)                                           \
-  ((C) > ' '                                                           \
-   && ((C) == 0x200C || (C) == 0x200D                                  \
-       || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)),  \
-          (INTEGERP (_work_val)                                        \
-           && (XINT (_work_val) <= UNICODE_CATEGORY_So)))))
+static bool
+char_composable_p (int c)
+{
+  Lisp_Object val;
+  return (c > ' '                      
+         && (c == 0x200C || c == 0x200D
+             || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
+                 (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
+}
 
 /* Update cmp_it->stop_pos to the next position after CHARPOS (and
    BYTEPOS) where character composition may happen.  If BYTEPOS is
@@ -1067,7 +1068,7 @@
        p = SDATA (string) + bytepos;
       c = STRING_CHAR_AND_LENGTH (p, len);
       limit = bytepos + len;
-      while (CHAR_COMPOSABLE_P (c))
+      while (char_composable_p (c))
        {
          val = CHAR_TABLE_REF (Vcomposition_function_table, c);
          if (! NILP (val))
@@ -1144,7 +1145,7 @@
       /* Skip all uncomposable characters.  */
       if (NILP (string))
        {
-         while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c))
+         while (charpos - 1 > endpos && ! char_composable_p (c))
            {
              DEC_BOTH (charpos, bytepos);
              c = FETCH_MULTIBYTE_CHAR (bytepos);
@@ -1152,7 +1153,7 @@
        }
       else
        {
-         while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c))
+         while (charpos - 1 > endpos && ! char_composable_p (c))
            {
              p--;
              while (! CHAR_HEAD_P (*p))
@@ -1486,7 +1487,7 @@
                  |-B-|-C-|--D--|
 
      Here, it is known that characters after positions 1 and 9 can
-     never be composed (i.e. ! CHAR_COMPOSABLE_P (CH)), and
+     never be composed (i.e. ! char_composable_p (CH)), and
      composition A is an invalid one because it's partially covered by
      the valid composition C.  And to know whether a composition is
      valid or not, the only way is to start searching forward from a
@@ -1510,7 +1511,7 @@
   while (1)
     {
       c = STRING_CHAR (cur.p);
-      if (! CHAR_COMPOSABLE_P (c))
+      if (! char_composable_p (c))
        {
          if (limit <= pos)     /* case (1)  */
            {
@@ -1519,7 +1520,7 @@
                  return 0;
                BACKWARD_CHAR (cur, stop);
                c = STRING_CHAR (cur.p);
-             } while (! CHAR_COMPOSABLE_P (c));
+             } while (! char_composable_p (c));
              fore_check_limit = cur.pos + 1;
            }
          else                  /* case (2) */
@@ -1535,7 +1536,7 @@
          prev = cur;
          BACKWARD_CHAR (cur, stop);
          c = STRING_CHAR (cur.p);
-         if (! CHAR_COMPOSABLE_P (c))
+         if (! char_composable_p (c))
            {
              cur = prev;
              break;

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2014-06-08 23:41:43 +0000
+++ b/src/fileio.c      2014-06-17 03:14:00 +0000
@@ -5762,24 +5762,6 @@
   return Qnil;
 }
 
-Lisp_Object
-Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object 
default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object 
predicate)
-{
-  struct gcpro gcpro1;
-  Lisp_Object args[7];
-
-  GCPRO1 (default_filename);
-  args[0] = intern ("read-file-name");
-  args[1] = prompt;
-  args[2] = dir;
-  args[3] = default_filename;
-  args[4] = mustmatch;
-  args[5] = initial;
-  args[6] = predicate;
-  RETURN_UNGCPRO (Ffuncall (7, args));
-}
-
-
 void
 init_fileio (void)
 {

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-06-13 15:55:48 +0000
+++ b/src/lisp.h        2014-06-17 03:14:00 +0000
@@ -4015,7 +4015,6 @@
 extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object,
                                 Lisp_Object, Lisp_Object, Lisp_Object,
                                 Lisp_Object, int);
-EXFUN (Fread_file_name, 6);     /* Not a normal DEFUN.  */
 extern void close_file_unwind (int);
 extern void fclose_unwind (void *);
 extern void restore_point_unwind (Lisp_Object);


reply via email to

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