Ticket #2040: 2040-const-char-error-to-char-error-redeclaration.patch

File 2040-const-char-error-to-char-error-redeclaration.patch, 2.5 KB (added by vit_r, 14 years ago)

first *error blocks all the rest errors in lib/search/regex.c

  • lib/search/regex.c

    From 68f67fcb80b65a8e2acca4d4db41a38acd2d23d8 Mon Sep 17 00:00:00 2001
    From: Vit Rosin <vit_r@list.ru>
    Date: Thu, 18 Feb 2010 13:53:32 +0000
    Subject: [PATCH]  'const char *error;' to 'char *error;' redeclaration
       because first *error blocks all the rest errors
    
    ---
     lib/search/regex.c |   17 ++++++++++-------
     1 files changed, 10 insertions(+), 7 deletions(-)
    
    diff --git a/lib/search/regex.c b/lib/search/regex.c
    index 0fb3866..8bc45e8 100644
    a b mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_ 
    481481#ifdef SEARCH_TYPE_GLIB 
    482482    GError *error = NULL; 
    483483#else /* SEARCH_TYPE_GLIB */ 
    484     const char *error; 
    485     int erroffset; 
     484    char *error = NULL; 
     485    int erroffset;     
    486486#endif /* SEARCH_TYPE_GLIB */ 
    487487 
    488488    if (!lc_mc_search->is_case_sentitive) { 
    mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_ 
    492492        g_string_free (tmp, TRUE); 
    493493    } 
    494494#ifdef SEARCH_TYPE_GLIB 
    495     mc_search_cond->regex_handle = 
    496         g_regex_new (mc_search_cond->str->str, G_REGEX_OPTIMIZE | G_REGEX_RAW | G_REGEX_DOTALL, 0, 
    497                      &error); 
     495    mc_search_cond->regex_handle = (mc_search_regex_t *) 
     496                                    g_regex_new (mc_search_cond->str->str, 
     497                                                G_REGEX_OPTIMIZE | G_REGEX_RAW | G_REGEX_DOTALL, 
     498                                                0, &error); 
    498499 
    499500    if (error != NULL) { 
    500501        lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE; 
    mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_ 
    503504        return; 
    504505    } 
    505506#else /* SEARCH_TYPE_GLIB */ 
    506     mc_search_cond->regex_handle = 
     507    mc_search_cond->regex_handle = (mc_search_regex_t *) 
    507508        pcre_compile (mc_search_cond->str->str, PCRE_EXTRA, &error, &erroffset, NULL); 
    508509    if (mc_search_cond->regex_handle == NULL) { 
    509510        lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE; 
    510511        lc_mc_search->error_str = g_strdup (error); 
     512        g_free (error); 
    511513        return; 
    512514    } 
    513515    lc_mc_search->regex_match_info = pcre_study (mc_search_cond->regex_handle, 0, &error); 
    514516    if (lc_mc_search->regex_match_info == NULL) { 
    515         if (error) { 
     517        if (error != NULL) { 
    516518            lc_mc_search->error = MC_SEARCH_E_REGEX_COMPILE; 
    517519            lc_mc_search->error_str = g_strdup (error); 
     520            g_free (error); 
    518521            g_free (mc_search_cond->regex_handle); 
    519522            mc_search_cond->regex_handle = NULL; 
    520523            return;