diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2015-01-13 07:08:54 +0300 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2015-01-13 07:08:54 +0300 |
commit | b53b1ca422ff1925f631be511fbec9deb1e4cc33 (patch) | |
tree | 5d39e0f04440b06fb1350a657839e868aa5996e9 /src/dired.c | |
parent | ad9c4a4091df19064a7f7f53bfdb687931e141f6 (diff) | |
download | emacs-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.c | 21 |
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; |