From 0d76e9aa34782e335c6c1595beaeb68d7747c4e8 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 6 May 2009 16:32:13 +0300 Subject: [PATCH] Search engine: if found_len parameter NULL, then mc_search_run don't try to fill them --- src/search/normal.c | 3 ++- src/search/regex.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/search/normal.c b/src/search/normal.c index a9b5b4792..2ede439da 100644 --- a/src/search/normal.c +++ b/src/search/normal.c @@ -119,7 +119,8 @@ mc_search__run_normal (mc_search_t * mc_search, const void *user_data, case COND__FOUND_CHAR_LAST: mc_search->normal_offset = current_pos; - *found_len = search_pos + 1; + if (found_len) + *found_len = search_pos + 1; return TRUE; break; diff --git a/src/search/regex.c b/src/search/regex.c index 83f83a2d9..70c05ae6f 100644 --- a/src/search/regex.c +++ b/src/search/regex.c @@ -453,7 +453,8 @@ mc_search__run_regex (mc_search_t * mc_search, const void *user_data, end_pos = mc_search->regex_match_info[0].rm_eo; #endif /* HAVE_LIBPCRE */ #endif /* GLIB_CHECK_VERSION (2, 14, 0) */ - *found_len = end_pos - start_pos; + if (found_len) + *found_len = end_pos - start_pos; mc_search->normal_offset = start_buffer + start_pos; return TRUE; break;