Ticket #3648: mc-3648-02-save-user-abort-request-at-search-function.patch

File mc-3648-02-save-user-abort-request-at-search-function.patch, 1.9 KB (added by and, 6 years ago)
  • lib/search/regex.c

    From 660a2e065adbbb057c47b34712598a6f29d87305 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 21 May 2016 14:24:13 +0000
    Subject: [PATCH] Save user abort request at generic search function
    
    Save user abort request as MC_SEARCH_CB_ABORT error status.
    
    It is a bit fuzzy here because of ret = MC_SEARCH_CB_ABORT initial default.
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     lib/search/regex.c | 9 ++++++++-
     1 file changed, 8 insertions(+), 1 deletion(-)
    
    diff --git a/lib/search/regex.c b/lib/search/regex.c
    index a172640..53e2729 100644
    a b mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data, 
    901901                ret = lc_mc_search->search_fn (user_data, current_pos, &current_chr); 
    902902 
    903903                if (ret == MC_SEARCH_CB_ABORT) 
     904                { 
     905                    lc_mc_search->error = MC_SEARCH_E_ABORT; 
    904906                    break; 
     907                } 
    905908 
    906909                if (ret == MC_SEARCH_CB_INVALID) 
    907910                    continue; 
    mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data, 
    967970 
    968971        if ((lc_mc_search->update_fn != NULL) && 
    969972            ((lc_mc_search->update_fn) (user_data, current_pos) == MC_SEARCH_CB_ABORT)) 
     973        { 
     974            lc_mc_search->error = MC_SEARCH_E_ABORT; 
    970975            ret = MC_SEARCH_CB_ABORT; 
     976        } 
    971977 
    972978        if (ret == MC_SEARCH_CB_ABORT) 
    973979            break; 
    mc_search__run_regex (mc_search_t * lc_mc_search, const void *user_data, 
    975981 
    976982    g_string_free (lc_mc_search->regex_buffer, TRUE); 
    977983    lc_mc_search->regex_buffer = NULL; 
    978     lc_mc_search->error = MC_SEARCH_E_NOTFOUND; 
     984    if (lc_mc_search->error != MC_SEARCH_E_ABORT) 
     985        lc_mc_search->error = MC_SEARCH_E_NOTFOUND; 
    979986 
    980987    if (ret != MC_SEARCH_CB_ABORT) 
    981988        lc_mc_search->error_str = g_strdup (_(STR_E_NOTFOUND));