diff --git a/src/search.c b/src/search.c index 3c413b9d..bd3ecabe 100644 --- a/src/search.c +++ b/src/search.c @@ -606,15 +606,15 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, } if (choice == 1 || replaceall) { /* Yes, replace it. */ - char *copy; size_t length_change; + char *altered; #ifndef NANO_TINY add_undo(REPLACE, NULL); #endif - copy = replace_line(needle); + altered = replace_line(needle); - length_change = strlen(copy) - strlen(openfile->current->data); + length_change = strlen(altered) - strlen(openfile->current->data); #ifndef NANO_TINY /* If the mark was on and it was located after the cursor, @@ -655,9 +655,9 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, openfile->current_x += match_len + length_change; /* Update the file size, and put the changed line into place. */ - openfile->totsize += mbstrlen(copy) - mbstrlen(openfile->current->data); + openfile->totsize += mbstrlen(altered) - mbstrlen(openfile->current->data); free(openfile->current->data); - openfile->current->data = copy; + openfile->current->data = altered; set_modified(); as_an_at = TRUE;