]> code.delx.au - gnu-emacs/commitdiff
Avoid extra multibyteness check in ENCODE_FILE users.
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 14 Jan 2015 06:50:39 +0000 (09:50 +0300)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 14 Jan 2015 06:50:39 +0000 (09:50 +0300)
* callproc.c (encode_current_directory, Fcall_process, call_process):
* dired.c (directory_files_internal, file_name_completion):
Do not check for STRING_MULTIBYTE because encode_file_name
is a no-op for unibyte strings.

src/ChangeLog
src/callproc.c
src/dired.c

index 67f48660b1ac2b5f6cb0e4dd59cff6cae2e1e81b..5055ed16fb4346880595ea46a8fafc98ddb30549 100644 (file)
@@ -1,3 +1,11 @@
+2015-01-14  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Avoid extra multibyteness check in ENCODE_FILE users.
+       * callproc.c (encode_current_directory, Fcall_process, call_process):
+       * dired.c (directory_files_internal, file_name_completion):
+       Do not check for STRING_MULTIBYTE because encode_file_name
+       is a no-op for unibyte strings.
+
 2015-01-14  Paul Eggert  <eggert@cs.ucla.edu>
 
        Use bool for boolean in xmenu.c, xml.c
index 0fdf278073d32070ba09a2925b4e0e0305d0b784..970a2017b387ac84d1b4fd4280f9ae279b8ba86d 100644 (file)
@@ -135,8 +135,7 @@ encode_current_directory (void)
   if (! NILP (Fstring_match (build_string ("^/:"), dir, Qnil)))
     dir = Fsubstring (dir, make_number (2), Qnil);
 
-  if (STRING_MULTIBYTE (dir))
-    dir = ENCODE_FILE (dir);
+  dir = ENCODE_FILE (dir);
   if (! file_accessible_directory_p (dir))
     report_file_error ("Setting current directory",
                       BVAR (current_buffer, directory));
@@ -267,7 +266,7 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS)  *
     infile = build_string (NULL_DEVICE);
 
   GCPRO1 (infile);
-  encoded_infile = STRING_MULTIBYTE (infile) ? ENCODE_FILE (infile) : infile;
+  encoded_infile = ENCODE_FILE (infile);
 
   filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0);
   if (filefd < 0)
@@ -439,9 +438,9 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
 
     GCPRO4 (buffer, current_dir, error_file, output_file);
 
-    if (STRINGP (error_file) && STRING_MULTIBYTE (error_file))
+    if (STRINGP (error_file))
       error_file = ENCODE_FILE (error_file);
-    if (STRINGP (output_file) && STRING_MULTIBYTE (output_file))
+    if (STRINGP (output_file))
       output_file = ENCODE_FILE (output_file);
     UNGCPRO;
   }
@@ -498,8 +497,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
       }
     else
       new_argv[1] = 0;
-    if (STRING_MULTIBYTE (path))
-      path = ENCODE_FILE (path);
+    path = ENCODE_FILE (path);
     new_argv[0] = SSDATA (path);
     UNGCPRO;
   }
index 9026c5678ef4ecbc01fb270e8b69c67ae3afdbc6..ca43cd902192d9052b03b96e37bfc4fd0ef778bb 100644 (file)
@@ -176,10 +176,8 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
   /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run
      run_pre_post_conversion_on_str which calls Lisp directly and
      indirectly.  */
-  if (STRING_MULTIBYTE (dirfilename))
-    dirfilename = ENCODE_FILE (dirfilename);
-  encoded_directory = (STRING_MULTIBYTE (directory)
-                      ? ENCODE_FILE (directory) : directory);
+  dirfilename = ENCODE_FILE (dirfilename);
+  encoded_directory = ENCODE_FILE (directory);
 
   /* Now *bufp is the compiled form of MATCH; don't call anything
      which might compile a new regexp until we're done with the loop!  */
@@ -482,7 +480,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
   /* Actually, this is not quite true any more: we do most of the completion
      work with decoded file names, but we still do some filtering based
      on the encoded file name.  */
-  encoded_file = STRING_MULTIBYTE (file) ? ENCODE_FILE (file) : file;
+  encoded_file = ENCODE_FILE (file);
 
   encoded_dir = ENCODE_FILE (Fdirectory_file_name (dirname));