Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
0af5788a
Commit
0af5788a
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: reduce the scope of five variables, and frob some comments
parent
d5b950cc
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/text.c
+9
-15
src/text.c
with
9 additions
and
15 deletions
+9
-15
src/text.c
View file @
0af5788a
...
...
@@ -2869,11 +2869,6 @@ const char *do_alt_speller(char *tempfile_name)
char
*
ptr
;
static
int
arglen
=
3
;
static
char
**
spellargs
=
NULL
;
#ifndef NANO_TINY
filestruct
*
top
,
*
bot
;
size_t
top_x
,
bot_x
;
bool
right_side_up
=
FALSE
;
#endif
/* Get the timestamp and the size of the temporary file. */
stat
(
tempfile_name
,
&
spellfileinfo
);
...
...
@@ -2886,7 +2881,7 @@ const char *do_alt_speller(char *tempfile_name)
/* Exit from curses mode. */
endwin
();
/* Set up
an
argument list to pass to execvp(). */
/* Set up
the
argument list to pass to execvp(). */
if
(
spellargs
==
NULL
)
{
spellargs
=
(
char
**
)
nmalloc
(
arglen
*
sizeof
(
char
*
));
...
...
@@ -2901,17 +2896,13 @@ const char *do_alt_speller(char *tempfile_name)
}
spellargs
[
arglen
-
2
]
=
tempfile_name
;
/*
Start a new
process
for
the alternate spell
er
. */
/*
Fork a child
process
and run
the alternate spell
program in it
. */
if
((
pid_spell
=
fork
())
==
0
)
{
/* Start alternate spell program; we are using $PATH. */
execvp
(
spellargs
[
0
],
spellargs
);
/*
Should not be reached, if
alternate speller is found
!!!
*/
/*
Terminate the child process if no
alternate speller is found
.
*/
exit
(
1
);
}
/* If we couldn't fork, get out. */
if
(
pid_spell
<
0
)
}
else
if
(
pid_spell
<
0
)
return
_
(
"Could not fork"
);
#ifndef NANO_TINY
...
...
@@ -2935,6 +2926,9 @@ const char *do_alt_speller(char *tempfile_name)
/* Replace the marked text (or the entire text) of the current buffer
* with the spell-checked text. */
if
(
openfile
->
mark_set
)
{
filestruct
*
top
,
*
bot
;
size_t
top_x
,
bot_x
;
bool
right_side_up
;
ssize_t
was_mark_lineno
=
openfile
->
mark_begin
->
lineno
;
openfile
->
mark_set
=
FALSE
;
...
...
@@ -2951,14 +2945,13 @@ const char *do_alt_speller(char *tempfile_name)
else
openfile
->
mark_begin_x
=
openfile
->
current_x
;
/* Restore the mark's position and turn it on. */
/* Restore the mark's position and turn it
back
on. */
openfile
->
mark_begin
=
fsfromline
(
was_mark_lineno
);
openfile
->
mark_set
=
TRUE
;
}
else
#endif
replace_buffer
(
tempfile_name
);
/* Go back to the old position. */
goto_line_posx
(
lineno_save
,
current_x_save
);
if
(
was_at_eol
||
openfile
->
current_x
>
strlen
(
openfile
->
current
->
data
))
...
...
@@ -2977,6 +2970,7 @@ const char *do_alt_speller(char *tempfile_name)
discard_until
(
NULL
,
openfile
);
#endif
}
#ifndef NANO_TINY
/* Unblock SIGWINCHes again. */
allow_sigwinch
(
TRUE
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help