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
b9de5525
Commit
b9de5525
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: elide a parameter, as it's always the inverse of another
parent
f4d1ef1c
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
+8
-11
src/files.c
src/nano.c
+1
-1
src/nano.c
src/proto.h
+1
-2
src/proto.h
src/text.c
+1
-1
src/text.c
with
11 additions
and
15 deletions
+11
-15
src/files.c
View file @
b9de5525
...
...
@@ -476,7 +476,7 @@ bool open_buffer(const char *filename, bool new_buffer)
/* If we have a non-new file, read it in. Then, if the buffer has
* no stat, update the stat, if applicable. */
if
(
rc
>
0
)
{
read_file
(
f
,
rc
,
realname
,
!
new_buffer
,
new_buffer
);
read_file
(
f
,
rc
,
realname
,
!
new_buffer
);
#ifndef NANO_TINY
if
(
openfile
->
current_stat
==
NULL
)
stat_with_alloc
(
realname
,
&
openfile
->
current_stat
);
...
...
@@ -522,7 +522,7 @@ void replace_buffer(const char *filename)
initialize_buffer_text
();
/* Insert the processed file into its place. */
read_file
(
f
,
descriptor
,
filename
,
FALSE
,
TRUE
);
read_file
(
f
,
descriptor
,
filename
,
FALSE
);
/* Put current at a place that is certain to exist. */
openfile
->
current
=
openfile
->
fileage
;
...
...
@@ -553,7 +553,7 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
* where the marked text was. */
extract_buffer
(
&
trash_top
,
&
trash_bot
,
top
,
top_x
,
bot
,
bot_x
);
free_filestruct
(
trash_top
);
read_file
(
f
,
descriptor
,
filename
,
FALSE
,
TRUE
);
read_file
(
f
,
descriptor
,
filename
,
FALSE
);
/* Restore the magicline behavior now that we're done fiddling. */
if
(
!
old_no_newlines
)
...
...
@@ -710,13 +710,10 @@ char *encode_data(char *buf, size_t buf_len)
return
mallocstrcpy
(
NULL
,
buf
);
}
/* Read an open file into the current buffer. f should be set to the
* open file, and filename should be set to the name of the file.
* undoable means do we want to create undo records to try and undo
* this. Will also attempt to check file writability if fd > 0 and
* checkwritable == TRUE. */
void
read_file
(
FILE
*
f
,
int
fd
,
const
char
*
filename
,
bool
undoable
,
bool
checkwritable
)
/* Read the given open file f into the current buffer. filename should be
* set to the name of the file. undoable means that undo records should be
* created and that the file does not need to be checked for writability. */
void
read_file
(
FILE
*
f
,
int
fd
,
const
char
*
filename
,
bool
undoable
)
{
ssize_t
was_lineno
=
openfile
->
current
->
lineno
;
/* The line number where we start the insertion. */
...
...
@@ -832,7 +829,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
if
(
ferror
(
f
))
nperror
(
filename
);
fclose
(
f
);
if
(
fd
>
0
&&
checkwrit
able
)
{
if
(
fd
>
0
&&
!
undo
able
)
{
close
(
fd
);
writable
=
is_file_writable
(
filename
);
}
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
b9de5525
...
...
@@ -1171,7 +1171,7 @@ bool scoop_stdin(void)
/* Read the input into a new buffer. */
open_buffer
(
""
,
TRUE
);
read_file
(
stream
,
0
,
"stdin"
,
TRUE
,
FALSE
);
read_file
(
stream
,
0
,
"stdin"
,
TRUE
);
openfile
->
edittop
=
openfile
->
fileage
;
/* Reconnect the tty as the input source. */
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
b9de5525
...
...
@@ -281,8 +281,7 @@ void switch_to_prev_buffer(void);
void
switch_to_next_buffer
(
void
);
bool
close_buffer
(
void
);
#endif
void
read_file
(
FILE
*
f
,
int
fd
,
const
char
*
filename
,
bool
undoable
,
bool
checkwritable
);
void
read_file
(
FILE
*
f
,
int
fd
,
const
char
*
filename
,
bool
undoable
);
int
open_file
(
const
char
*
filename
,
bool
newfie
,
bool
quiet
,
FILE
**
f
);
char
*
get_next_filename
(
const
char
*
name
,
const
char
*
suffix
);
void
do_insertfile_void
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
b9de5525
...
...
@@ -1149,7 +1149,7 @@ bool execute_command(const char *command)
if
(
f
==
NULL
)
nperror
(
"fdopen"
);
read_file
(
f
,
0
,
"stdin"
,
TRUE
,
FALSE
);
read_file
(
f
,
0
,
"stdin"
,
TRUE
);
if
(
wait
(
NULL
)
==
-
1
)
nperror
(
"wait"
);
...
...
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