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
0b33ab55
Commit
0b33ab55
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
files: make an 'if' more transparent and snip an unneeded condition
Also unwrap or improve some comments.
parent
2faad123
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/files.c
+10
-14
src/files.c
with
10 additions
and
14 deletions
+10
-14
src/files.c
View file @
0b33ab55
...
...
@@ -2195,7 +2195,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
{
bool
retval
;
bool
old_modified
=
openfile
->
modified
;
/* write_file() unsets the modified flag. */
/*
Save the status, because
write_file() unsets the modified flag. */
bool
added_magicline
=
FALSE
;
/* Whether we added a magicline after filebot. */
filestruct
*
top
,
*
bot
;
...
...
@@ -2203,29 +2203,25 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
assert
(
openfile
->
mark_set
);
/* Partition the filestruct so that it contains only the marked
* text. */
/* Partition the filestruct so that it contains only the marked text. */
mark_order
((
const
filestruct
**
)
&
top
,
&
top_x
,
(
const
filestruct
**
)
&
bot
,
&
bot_x
,
NULL
);
filepart
=
partition_filestruct
(
top
,
top_x
,
bot
,
bot_x
);
/* Handle the magicline if the NO_NEWLINES flag isn't set. If the
* line at filebot is blank, treat it as the magicline and hence the
* end of the file. Otherwise, add a magicline and treat it as the
* end of the file. */
if
(
!
ISSET
(
NO_NEWLINES
)
&&
(
added_magicline
=
(
openfile
->
filebot
->
data
[
0
]
!=
'\0'
)))
/* If we are doing magicline, and the last line of the partition
* isn't blank, then add a newline at the end of the buffer. */
if
(
!
ISSET
(
NO_NEWLINES
)
&&
openfile
->
filebot
->
data
[
0
]
!=
'\0'
)
{
new_magicline
();
added_magicline
=
TRUE
;
}
retval
=
write_file
(
name
,
f_open
,
tmp
,
append
,
TRUE
);
/* If the NO_NEWLINES flag isn't set, and we added a magicline,
* remove it now. */
if
(
!
ISSET
(
NO_NEWLINES
)
&&
added_magicline
)
/* If we added a magicline, remove it now. */
if
(
added_magicline
)
remove_magicline
();
/* Unpartition the filestruct so that it contains all the text
* again. */
/* Unpartition the filestruct so that it contains all the text again. */
unpartition_filestruct
(
&
filepart
);
if
(
old_modified
)
...
...
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