Skip to content
GitLab
Menu
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
ab8698df
Commit
ab8698df
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: condense some code, to remove a bit of duplication
parent
206d89b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nano.c
+16
-26
src/nano.c
with
16 additions
and
26 deletions
+16
-26
src/nano.c
View file @
ab8698df
...
...
@@ -586,6 +586,7 @@ void finish(void)
void
die
(
const
char
*
msg
,
...)
{
va_list
ap
;
openfilestruct
*
firstone
=
openfile
;
curs_set
(
1
);
endwin
();
...
...
@@ -597,38 +598,27 @@ void die(const char *msg, ...)
vfprintf
(
stderr
,
msg
,
ap
);
va_end
(
ap
);
while
(
openfile
)
{
#ifndef NANO_TINY
/* If the current buffer has a lockfile, remove it. */
if
(
openfile
&&
ISSET
(
LOCKING
)
&&
openfile
->
lock_filename
)
delete_lockfile
(
openfile
->
lock_filename
);
/* If the current buffer has a lockfile, remove it. */
if
(
ISSET
(
LOCKING
)
&&
openfile
->
lock_filename
)
delete_lockfile
(
openfile
->
lock_filename
);
#endif
/* If the current file buffer was modified, save it. */
if
(
openfile
->
modified
)
{
/* If the buffer is partitioned, unpartition it first. */
if
(
filepart
!=
NULL
)
unpartition_filestruct
(
&
filepart
);
/* If the current file buffer was modified, save it. */
if
(
openfile
&&
openfile
->
modified
)
{
/* If the buffer is partitioned, unpartition it first. */
if
(
filepart
!=
NULL
)
unpartition_filestruct
(
&
filepart
);
die_save_file
(
openfile
->
filename
,
openfile
->
current_stat
);
}
#ifdef ENABLE_MULTIBUFFER
/* Save all of the other modified file buffers, if any. */
if
(
openfile
!=
NULL
)
{
openfilestruct
*
firstone
=
openfile
;
die_save_file
(
openfile
->
filename
,
openfile
->
current_stat
);
}
while
(
openfile
->
nex
t
!
=
firstone
)
{
openfile
=
openfile
->
next
;
filepar
t
=
NULL
;
openfile
=
openfile
->
next
;
#ifndef NANO_TINY
if
(
ISSET
(
LOCKING
)
&&
openfile
->
lock_filename
)
delete_lockfile
(
openfile
->
lock_filename
);
#endif
if
(
openfile
->
modified
)
die_save_file
(
openfile
->
filename
,
openfile
->
current_stat
);
}
if
(
openfile
==
firstone
)
break
;
}
#endif
/* Abandon the building. */
exit
(
1
);
...
...
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