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
0c40f87b
Commit
0c40f87b
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: invert the logic of a variable, and rename it
To get rid of two double negatives.
parent
4761e008
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/files.c
+9
-9
src/files.c
src/nano.c
+1
-1
src/nano.c
src/proto.h
+1
-1
src/proto.h
src/text.c
+2
-2
src/text.c
with
13 additions
and
13 deletions
+13
-13
src/files.c
View file @
0c40f87b
...
...
@@ -1522,13 +1522,13 @@ int copy_file(FILE *inn, FILE *out, bool close_out)
* use it when spell checking or dumping the file on an error. If
* method is APPEND, it means we are appending instead of overwriting.
* If method is PREPEND, it means we are prepending instead of
* overwriting. If
nonamechange
is TRUE, we
don't change the current
*
filename. nonamechange
is irrelevant when appending or prepending,
* overwriting. If
fullbuffer
is TRUE, we
set the current filename and
*
stat info. But fullbuffer
is irrelevant when appending or prepending,
* or when writing a temporary file.
*
* Return TRUE on success or FALSE on error. */
bool
write_file
(
const
char
*
name
,
FILE
*
f_open
,
bool
tmp
,
kind_of_writing_type
method
,
bool
nonamechange
)
kind_of_writing_type
method
,
bool
fullbuffer
)
{
bool
retval
=
FALSE
;
/* Instead of returning in this function, you should always
...
...
@@ -1919,7 +1919,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
if
(
method
==
OVERWRITE
&&
!
tmp
)
{
/* If we must set the filename, and it changed, adjust things. */
if
(
!
nonamechange
&&
strcmp
(
openfile
->
filename
,
realname
)
!=
0
)
{
if
(
fullbuffer
&&
strcmp
(
openfile
->
filename
,
realname
)
!=
0
)
{
#ifdef ENABLE_COLOR
const
char
*
oldname
,
*
newname
;
...
...
@@ -1950,7 +1950,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
}
#ifndef NANO_TINY
if
(
!
nonamechange
)
if
(
fullbuffer
)
/* Get or update the stat info to reflect the current state. */
stat_with_alloc
(
realname
,
&
openfile
->
current_stat
);
#endif
...
...
@@ -1978,7 +1978,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
{
bool
retval
;
bool
old_modified
=
openfile
->
modified
;
/* Save the status,
because write_
file
()
unsets the modified flag. */
/* Save the status,
as writing the
file unsets the modified flag. */
bool
added_magicline
=
FALSE
;
/* Whether we added a magicline after filebot. */
filestruct
*
top
,
*
bot
;
...
...
@@ -1996,7 +1996,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
added_magicline
=
TRUE
;
}
retval
=
write_file
(
name
,
f_open
,
tmp
,
method
,
TRU
E
);
retval
=
write_file
(
name
,
f_open
,
tmp
,
method
,
FALS
E
);
/* If we added a magicline, remove it now. */
if
(
added_magicline
)
...
...
@@ -2225,7 +2225,7 @@ int do_writeout(bool exiting, bool withprompt)
free
(
given
);
if
(
response
==
1
)
return
write_file
(
openfile
->
filename
,
NULL
,
FALSE
,
OVERWRITE
,
FALS
E
);
NULL
,
FALSE
,
OVERWRITE
,
TRU
E
);
else
if
(
response
==
0
)
return
2
;
else
...
...
@@ -2247,7 +2247,7 @@ int do_writeout(bool exiting, bool withprompt)
result
=
write_marked_file
(
answer
,
NULL
,
FALSE
,
method
);
else
#endif
result
=
write_file
(
answer
,
NULL
,
FALSE
,
method
,
FALS
E
);
result
=
write_file
(
answer
,
NULL
,
FALSE
,
method
,
TRU
E
);
break
;
}
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
0c40f87b
...
...
@@ -651,7 +651,7 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
targetname
=
get_next_filename
(
die_filename
,
".save"
);
if
(
*
targetname
!=
'\0'
)
failed
=
!
write_file
(
targetname
,
NULL
,
TRUE
,
OVERWRITE
,
TRU
E
);
failed
=
!
write_file
(
targetname
,
NULL
,
TRUE
,
OVERWRITE
,
FALS
E
);
if
(
!
failed
)
fprintf
(
stderr
,
_
(
"
\n
Buffer written to %s
\n
"
),
targetname
);
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
0c40f87b
...
...
@@ -298,7 +298,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
#endif
int
copy_file
(
FILE
*
inn
,
FILE
*
out
,
bool
close_out
);
bool
write_file
(
const
char
*
name
,
FILE
*
f_open
,
bool
tmp
,
kind_of_writing_type
method
,
bool
nonamechange
);
kind_of_writing_type
method
,
bool
fullbuffer
);
#ifndef NANO_TINY
bool
write_marked_file
(
const
char
*
name
,
FILE
*
f_open
,
bool
tmp
,
kind_of_writing_type
method
);
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
0c40f87b
...
...
@@ -3004,7 +3004,7 @@ void do_spell(void)
status
=
write_marked_file
(
temp
,
temp_file
,
TRUE
,
OVERWRITE
);
else
#endif
status
=
write_file
(
temp
,
temp_file
,
TRUE
,
OVERWRITE
,
FALS
E
);
status
=
write_file
(
temp
,
temp_file
,
TRUE
,
OVERWRITE
,
TRU
E
);
if
(
!
status
)
{
statusline
(
ALERT
,
_
(
"Error writing temp file: %s"
),
strerror
(
errno
));
...
...
@@ -3395,7 +3395,7 @@ void do_formatter(void)
/* We're not supporting partial formatting, oi vey. */
openfile
->
mark
=
NULL
;
#endif
status
=
write_file
(
temp
,
temp_file
,
TRUE
,
OVERWRITE
,
FALS
E
);
status
=
write_file
(
temp
,
temp_file
,
TRUE
,
OVERWRITE
,
TRU
E
);
if
(
!
status
)
{
statusline
(
ALERT
,
_
(
"Error writing temp file: %s"
),
strerror
(
errno
));
...
...
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