bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(info-stnd) search.c:regexp_search() finishes too early


From: Gavin Smith
Subject: (info-stnd) search.c:regexp_search() finishes too early
Date: Tue, 7 Jan 2014 19:35:12 +0000

In the info browser in the search.c file, the regexp_search function
takes a parameter of  SEARCH_BINDING *binding, which contains a
pointer to the text to be searched with a regular expression, and
offsets into the text specifying the range to be searched.

It works by replacing a character in the buffer with a null character
and using the regexec() function that works with null-terminated
strings. However, the way the code is places the null character too
early if binding->start is not 0.

I believe the following patch is needed. Apologies, I don't know how
format a patch for svn.

diff search.c.old search.c
193,194c193,194
<       saved_char = previous_content[content_length-1];
<       previous_content[content_length-1] = '\0';
---
>       saved_char = previous_content[end];
>       previous_content[end] = '\0';
229c229
<       previous_content[content_length-1] = saved_char;
---
>       previous_content[end] = saved_char;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]