diff options
| author | Dmitry Antipov | 2015-01-14 09:50:39 +0300 |
|---|---|---|
| committer | Dmitry Antipov | 2015-01-14 09:50:39 +0300 |
| commit | 01ebf7a3655541ef09cee068bddffbc1b38c69c8 (patch) | |
| tree | 41300cd8f3167f16aebc536d8322dbc757eb4f5a | |
| parent | 3ef29501b029567156440d257c758b99099213fe (diff) | |
| download | emacs-01ebf7a3655541ef09cee068bddffbc1b38c69c8.tar.gz emacs-01ebf7a3655541ef09cee068bddffbc1b38c69c8.zip | |
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.
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/callproc.c | 12 | ||||
| -rw-r--r-- | src/dired.c | 8 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 67f48660b1a..5055ed16fb4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2015-01-14 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Avoid extra multibyteness check in ENCODE_FILE users. | ||
| 4 | * callproc.c (encode_current_directory, Fcall_process, call_process): | ||
| 5 | * dired.c (directory_files_internal, file_name_completion): | ||
| 6 | Do not check for STRING_MULTIBYTE because encode_file_name | ||
| 7 | is a no-op for unibyte strings. | ||
| 8 | |||
| 1 | 2015-01-14 Paul Eggert <eggert@cs.ucla.edu> | 9 | 2015-01-14 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 10 | ||
| 3 | Use bool for boolean in xmenu.c, xml.c | 11 | Use bool for boolean in xmenu.c, xml.c |
diff --git a/src/callproc.c b/src/callproc.c index 0fdf278073d..970a2017b38 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -135,8 +135,7 @@ encode_current_directory (void) | |||
| 135 | if (! NILP (Fstring_match (build_string ("^/:"), dir, Qnil))) | 135 | if (! NILP (Fstring_match (build_string ("^/:"), dir, Qnil))) |
| 136 | dir = Fsubstring (dir, make_number (2), Qnil); | 136 | dir = Fsubstring (dir, make_number (2), Qnil); |
| 137 | 137 | ||
| 138 | if (STRING_MULTIBYTE (dir)) | 138 | dir = ENCODE_FILE (dir); |
| 139 | dir = ENCODE_FILE (dir); | ||
| 140 | if (! file_accessible_directory_p (dir)) | 139 | if (! file_accessible_directory_p (dir)) |
| 141 | report_file_error ("Setting current directory", | 140 | report_file_error ("Setting current directory", |
| 142 | BVAR (current_buffer, directory)); | 141 | BVAR (current_buffer, directory)); |
| @@ -267,7 +266,7 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) * | |||
| 267 | infile = build_string (NULL_DEVICE); | 266 | infile = build_string (NULL_DEVICE); |
| 268 | 267 | ||
| 269 | GCPRO1 (infile); | 268 | GCPRO1 (infile); |
| 270 | encoded_infile = STRING_MULTIBYTE (infile) ? ENCODE_FILE (infile) : infile; | 269 | encoded_infile = ENCODE_FILE (infile); |
| 271 | 270 | ||
| 272 | filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0); | 271 | filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0); |
| 273 | if (filefd < 0) | 272 | if (filefd < 0) |
| @@ -439,9 +438,9 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 439 | 438 | ||
| 440 | GCPRO4 (buffer, current_dir, error_file, output_file); | 439 | GCPRO4 (buffer, current_dir, error_file, output_file); |
| 441 | 440 | ||
| 442 | if (STRINGP (error_file) && STRING_MULTIBYTE (error_file)) | 441 | if (STRINGP (error_file)) |
| 443 | error_file = ENCODE_FILE (error_file); | 442 | error_file = ENCODE_FILE (error_file); |
| 444 | if (STRINGP (output_file) && STRING_MULTIBYTE (output_file)) | 443 | if (STRINGP (output_file)) |
| 445 | output_file = ENCODE_FILE (output_file); | 444 | output_file = ENCODE_FILE (output_file); |
| 446 | UNGCPRO; | 445 | UNGCPRO; |
| 447 | } | 446 | } |
| @@ -498,8 +497,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 498 | } | 497 | } |
| 499 | else | 498 | else |
| 500 | new_argv[1] = 0; | 499 | new_argv[1] = 0; |
| 501 | if (STRING_MULTIBYTE (path)) | 500 | path = ENCODE_FILE (path); |
| 502 | path = ENCODE_FILE (path); | ||
| 503 | new_argv[0] = SSDATA (path); | 501 | new_argv[0] = SSDATA (path); |
| 504 | UNGCPRO; | 502 | UNGCPRO; |
| 505 | } | 503 | } |
diff --git a/src/dired.c b/src/dired.c index 9026c5678ef..ca43cd90219 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -176,10 +176,8 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, | |||
| 176 | /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run | 176 | /* Note: ENCODE_FILE and DECODE_FILE can GC because they can run |
| 177 | run_pre_post_conversion_on_str which calls Lisp directly and | 177 | run_pre_post_conversion_on_str which calls Lisp directly and |
| 178 | indirectly. */ | 178 | indirectly. */ |
| 179 | if (STRING_MULTIBYTE (dirfilename)) | 179 | dirfilename = ENCODE_FILE (dirfilename); |
| 180 | dirfilename = ENCODE_FILE (dirfilename); | 180 | encoded_directory = ENCODE_FILE (directory); |
| 181 | encoded_directory = (STRING_MULTIBYTE (directory) | ||
| 182 | ? ENCODE_FILE (directory) : directory); | ||
| 183 | 181 | ||
| 184 | /* Now *bufp is the compiled form of MATCH; don't call anything | 182 | /* Now *bufp is the compiled form of MATCH; don't call anything |
| 185 | which might compile a new regexp until we're done with the loop! */ | 183 | 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, | |||
| 482 | /* Actually, this is not quite true any more: we do most of the completion | 480 | /* Actually, this is not quite true any more: we do most of the completion |
| 483 | work with decoded file names, but we still do some filtering based | 481 | work with decoded file names, but we still do some filtering based |
| 484 | on the encoded file name. */ | 482 | on the encoded file name. */ |
| 485 | encoded_file = STRING_MULTIBYTE (file) ? ENCODE_FILE (file) : file; | 483 | encoded_file = ENCODE_FILE (file); |
| 486 | 484 | ||
| 487 | encoded_dir = ENCODE_FILE (Fdirectory_file_name (dirname)); | 485 | encoded_dir = ENCODE_FILE (Fdirectory_file_name (dirname)); |
| 488 | 486 | ||