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
231fe4bf
Commit
231fe4bf
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename a function and swap its two parameters
parent
067a9205
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/history.c
+7
-9
src/history.c
with
7 additions
and
9 deletions
+7
-9
src/history.c
View file @
231fe4bf
...
...
@@ -358,23 +358,21 @@ void load_history(void)
free
(
legacyhist
);
}
/* Write the lines of a history list, starting with the line at head, to
* the open file at hist. Return TRUE if the write succeeded, and FALSE
* otherwise. */
bool
writehist
(
FILE
*
hist
,
const
filestruct
*
head
)
/* Write the lines of a history list, starting at head, from oldest to newest,
* to the given file. Return TRUE if writing succeeded, and FALSE otherwise. */
bool
write_list
(
const
filestruct
*
head
,
FILE
*
histfile
)
{
const
filestruct
*
item
;
/* Write a history list, from the oldest item to the newest. */
for
(
item
=
head
;
item
!=
NULL
;
item
=
item
->
next
)
{
size_t
length
=
strlen
(
item
->
data
);
/* Decode 0x0A bytes as embedded NULs. */
sunder
(
item
->
data
);
if
(
fwrite
(
item
->
data
,
sizeof
(
char
),
length
,
hist
)
<
length
)
if
(
fwrite
(
item
->
data
,
sizeof
(
char
),
length
,
hist
file
)
<
length
)
return
FALSE
;
if
(
putc
(
'\n'
,
hist
)
==
EOF
)
if
(
putc
(
'\n'
,
hist
file
)
==
EOF
)
return
FALSE
;
}
...
...
@@ -405,8 +403,8 @@ void save_history(void)
/* Don't allow others to read or write the history file. */
chmod
(
searchhist
,
S_IRUSR
|
S_IWUSR
);
if
(
!
write
h
ist
(
hist
,
searchtop
)
||
!
write
h
ist
(
hist
,
replacetop
)
||
!
write
h
ist
(
hist
,
executetop
))
if
(
!
write
_l
ist
(
searchtop
,
hist
)
||
!
write
_l
ist
(
replacetop
,
hist
)
||
!
write
_l
ist
(
executetop
,
hist
))
fprintf
(
stderr
,
_
(
"Error writing %s: %s
\n
"
),
searchhist
,
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