809 | | while (TRUE) |
810 | | { |
811 | | int current_chr = '\n'; /* stop search symbol */ |
812 | | |
813 | | ret = mc_search__get_char (lc_mc_search, user_data, current_pos, ¤t_chr); |
814 | | if (ret == MC_SEARCH_CB_ABORT) |
815 | | break; |
816 | | |
817 | | if (ret == MC_SEARCH_CB_INVALID) |
818 | | continue; |
819 | | |
820 | | current_pos++; |
821 | | |
822 | | if (ret == MC_SEARCH_CB_SKIP) |
823 | | continue; |
824 | | |
825 | | virtual_pos++; |
826 | | |
827 | | g_string_append_c (lc_mc_search->regex_buffer, (char) current_chr); |
828 | | |
829 | | if ((char) current_chr == '\n' || virtual_pos > end_search) |
830 | | break; |
| 809 | if (lc_mc_search->search_fn == NULL) { |
| 810 | /* optimization for standard case (for search from file manager) |
| 811 | * where there is no MC_SEARCH_CB_INVALID or MC_SEARCH_CB_SKIP |
| 812 | * return codes, so we can copy line at regex buffer all at once |
| 813 | */ |
| 814 | char current_chr; |
| 815 | while (TRUE) { |
| 816 | current_chr = ((char *)user_data)[current_pos]; |
| 817 | if (current_chr == 0) |
| 818 | break; |
| 819 | |
| 820 | current_pos++; |
| 821 | |
| 822 | if (current_chr == '\n' || current_pos > end_search) |
| 823 | break; |
| 824 | } |
| 825 | /* use virtual_pos as index of start of current chunk */ |
| 826 | g_string_append_len (lc_mc_search->regex_buffer, ((char *)user_data + virtual_pos), current_pos - virtual_pos); |
| 827 | virtual_pos = current_pos; |
| 828 | } else { |
| 829 | while (TRUE) |
| 830 | { |
| 831 | int current_chr = '\n'; /* stop search symbol */ |
| 832 | |
| 833 | ret = mc_search__get_char (lc_mc_search, user_data, current_pos, ¤t_chr); |
| 834 | if (ret == MC_SEARCH_CB_ABORT) |
| 835 | break; |
| 836 | |
| 837 | if (ret == MC_SEARCH_CB_INVALID) |
| 838 | continue; |
| 839 | |
| 840 | current_pos++; |
| 841 | |
| 842 | if (ret == MC_SEARCH_CB_SKIP) |
| 843 | continue; |
| 844 | |
| 845 | virtual_pos++; |
| 846 | |
| 847 | g_string_append_c (lc_mc_search->regex_buffer, (char) current_chr); |
| 848 | |
| 849 | if ((char) current_chr == '\n' || virtual_pos > end_search) |
| 850 | break; |
| 851 | } |