diff options
| author | Dmitry Antipov | 2015-01-13 07:08:54 +0300 |
|---|---|---|
| committer | Dmitry Antipov | 2015-01-13 07:08:54 +0300 |
| commit | b53b1ca422ff1925f631be511fbec9deb1e4cc33 (patch) | |
| tree | 5d39e0f04440b06fb1350a657839e868aa5996e9 /src/dired.c | |
| parent | ad9c4a4091df19064a7f7f53bfdb687931e141f6 (diff) | |
| download | emacs-b53b1ca422ff1925f631be511fbec9deb1e4cc33.tar.gz emacs-b53b1ca422ff1925f631be511fbec9deb1e4cc33.zip | |
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, | |||
| 634 | name = DECODE_FILE (name); | 634 | name = DECODE_FILE (name); |
| 635 | 635 | ||
| 636 | { | 636 | { |
| 637 | Lisp_Object regexps; | 637 | Lisp_Object regexps, table = (completion_ignore_case |
| 638 | ? Vascii_canon_table : Qnil); | ||
| 638 | 639 | ||
| 639 | /* Ignore this element if it fails to match all the regexps. */ | 640 | /* Ignore this element if it fails to match all the regexps. */ |
| 640 | if (completion_ignore_case) | 641 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
| 641 | { | 642 | regexps = XCDR (regexps)) |
| 642 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 643 | if (fast_string_match_internal (XCAR (regexps), name, table) < 0) |
| 643 | regexps = XCDR (regexps)) | 644 | break; |
| 644 | if (fast_string_match_ignore_case (XCAR (regexps), name) < 0) | ||
| 645 | break; | ||
| 646 | } | ||
| 647 | else | ||
| 648 | { | ||
| 649 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); | ||
| 650 | regexps = XCDR (regexps)) | ||
| 651 | if (fast_string_match (XCAR (regexps), name) < 0) | ||
| 652 | break; | ||
| 653 | } | ||
| 654 | 645 | ||
| 655 | if (CONSP (regexps)) | 646 | if (CONSP (regexps)) |
| 656 | continue; | 647 | continue; |