mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-09 11:11:59 +03:00
tweaks: rename some variables, to be less repititious
The repeated 'read_buff_' made everything look the same.
This commit is contained in:
parent
fa48d523b2
commit
55699dc171
52
src/text.c
52
src/text.c
@ -2437,8 +2437,8 @@ bool fix_spello(const char *word)
|
|||||||
* termination, and the error string otherwise. */
|
* termination, and the error string otherwise. */
|
||||||
const char *do_int_speller(const char *tempfile_name)
|
const char *do_int_speller(const char *tempfile_name)
|
||||||
{
|
{
|
||||||
char *read_buff, *read_buff_ptr, *read_buff_word;
|
char *misspellings, *pointer, *oneword;
|
||||||
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
|
size_t blocksize, buffersize, bytesread, totalread;
|
||||||
int spell_fd[2], sort_fd[2], uniq_fd[2], tempfile_fd = -1;
|
int spell_fd[2], sort_fd[2], uniq_fd[2], tempfile_fd = -1;
|
||||||
pid_t pid_spell, pid_sort, pid_uniq;
|
pid_t pid_spell, pid_sort, pid_uniq;
|
||||||
int spell_status, sort_status, uniq_status;
|
int spell_status, sort_status, uniq_status;
|
||||||
@ -2538,25 +2538,25 @@ const char *do_int_speller(const char *tempfile_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the system pipe buffer size. */
|
/* Get the system pipe buffer size. */
|
||||||
if ((pipe_buff_size = fpathconf(uniq_fd[0], _PC_PIPE_BUF)) < 1) {
|
if ((blocksize = fpathconf(uniq_fd[0], _PC_PIPE_BUF)) < 1) {
|
||||||
close(uniq_fd[0]);
|
close(uniq_fd[0]);
|
||||||
return _("Could not get size of pipe buffer");
|
return _("Could not get size of pipe buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in the returned spelling errors. */
|
/* Read in the returned spelling errors. */
|
||||||
read_buff_read = 0;
|
totalread = 0;
|
||||||
read_buff_size = pipe_buff_size + 1;
|
buffersize = blocksize + 1;
|
||||||
read_buff = charalloc(read_buff_size);
|
misspellings = charalloc(buffersize);
|
||||||
read_buff_ptr = read_buff;
|
pointer = misspellings;
|
||||||
|
|
||||||
while ((bytesread = read(uniq_fd[0], read_buff_ptr, pipe_buff_size)) > 0) {
|
while ((bytesread = read(uniq_fd[0], pointer, blocksize)) > 0) {
|
||||||
read_buff_read += bytesread;
|
totalread += bytesread;
|
||||||
read_buff_size += pipe_buff_size;
|
buffersize += blocksize;
|
||||||
read_buff = charealloc(read_buff, read_buff_size);
|
misspellings = charealloc(misspellings, buffersize);
|
||||||
read_buff_ptr = read_buff + read_buff_read;
|
pointer = misspellings + totalread;
|
||||||
}
|
}
|
||||||
|
|
||||||
*read_buff_ptr = '\0';
|
*pointer = '\0';
|
||||||
close(uniq_fd[0]);
|
close(uniq_fd[0]);
|
||||||
|
|
||||||
/* Do any replacements case sensitive, forward, and without regexes. */
|
/* Do any replacements case sensitive, forward, and without regexes. */
|
||||||
@ -2564,29 +2564,29 @@ const char *do_int_speller(const char *tempfile_name)
|
|||||||
UNSET(BACKWARDS_SEARCH);
|
UNSET(BACKWARDS_SEARCH);
|
||||||
UNSET(USE_REGEXP);
|
UNSET(USE_REGEXP);
|
||||||
|
|
||||||
read_buff_ptr = read_buff;
|
pointer = misspellings;
|
||||||
read_buff_word = read_buff;
|
oneword = misspellings;
|
||||||
|
|
||||||
/* Process each of the misspelled words. */
|
/* Process each of the misspelled words. */
|
||||||
while (*read_buff_ptr != '\0') {
|
while (*pointer != '\0') {
|
||||||
if ((*read_buff_ptr == '\r') || (*read_buff_ptr == '\n')) {
|
if ((*pointer == '\r') || (*pointer == '\n')) {
|
||||||
*read_buff_ptr = '\0';
|
*pointer = '\0';
|
||||||
if (read_buff_word != read_buff_ptr) {
|
if (oneword != pointer) {
|
||||||
if (!fix_spello(read_buff_word)) {
|
if (!fix_spello(oneword)) {
|
||||||
read_buff_word = read_buff_ptr;
|
oneword = pointer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
read_buff_word = read_buff_ptr + 1;
|
oneword = pointer + 1;
|
||||||
}
|
}
|
||||||
read_buff_ptr++;
|
pointer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Special case: the last word doesn't end with '\r' or '\n'. */
|
/* Special case: the last word doesn't end with '\r' or '\n'. */
|
||||||
if (read_buff_word != read_buff_ptr)
|
if (oneword != pointer)
|
||||||
fix_spello(read_buff_word);
|
fix_spello(oneword);
|
||||||
|
|
||||||
free(read_buff);
|
free(misspellings);
|
||||||
tidy_up_after_search();
|
tidy_up_after_search();
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user