summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2015-01-13 07:08:54 +0300
committerDmitry Antipov <dmantipov@yandex.ru>2015-01-13 07:08:54 +0300
commitb53b1ca422ff1925f631be511fbec9deb1e4cc33 (patch)
tree5d39e0f04440b06fb1350a657839e868aa5996e9 /src/dired.c
parentad9c4a4091df19064a7f7f53bfdb687931e141f6 (diff)
downloademacs-b53b1ca422ff1925f631be511fbec9deb1e4cc33.tar.gz
Consolidate duplicated string matching code.
* search.c (fast_string_match_internal): New function, consolidated from... (fast_string_match, fast_string_match_ignore_case): ...functions which are... * lisp.h (fast_string_match, fast_string_match_ignore_case): inlined from here now. (fast_string_match_internal): Add prototype. * dired.c (file_name_completion): Use fast_string_match_internal.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/dired.c b/src/dired.c
index 00f9a5b0765..9026c5678ef 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -634,23 +634,14 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
name = DECODE_FILE (name);
{
- Lisp_Object regexps;
+ Lisp_Object regexps, table = (completion_ignore_case
+ ? Vascii_canon_table : Qnil);
/* Ignore this element if it fails to match all the regexps. */
- if (completion_ignore_case)
- {
- for (regexps = Vcompletion_regexp_list; CONSP (regexps);
- regexps = XCDR (regexps))
- if (fast_string_match_ignore_case (XCAR (regexps), name) < 0)
- break;
- }
- else
- {
- for (regexps = Vcompletion_regexp_list; CONSP (regexps);
- regexps = XCDR (regexps))
- if (fast_string_match (XCAR (regexps), name) < 0)
- break;
- }
+ for (regexps = Vcompletion_regexp_list; CONSP (regexps);
+ regexps = XCDR (regexps))
+ if (fast_string_match_internal (XCAR (regexps), name, table) < 0)
+ break;
if (CONSP (regexps))
continue;