}
void free_matcher(matcher_t *matcher) {
- if(matcher->nb_patterns >= 0) {
+ if(matcher->nb_patterns < 0) {
+ if(!matcher->regexp_error) regfree(&matcher->preg);
+ } else {
delete[] matcher->splitted_patterns;
delete[] matcher->patterns;
- } else {
- if(!matcher->regexp_error) regfree(&matcher->preg);
}
}
int first_line = new_line, last_line = new_line, nb_match = 1;
// We find the first and last line to show, so that the total of
- // visible lines between them (them include) is console_height - 1
+ // visible lines between them (them included) is console_height-1
while(nb_match < console_height-1 && (first_line > 0 || last_line < nb_lines - 1)) {
k++;
}
- // We fill the rest of the line with blanks if either we did
- // not clear() or if this is the highlighted line
+ // We fill the rest of the line with blanks if this is the
+ // highlighted line
if(l == new_line) {
while(k < console_width) {