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
cb3fc889
Commit
cb3fc889
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename a variable and rewrap two lines
parent
06d9ee89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/files.c
+11
-10
src/files.c
with
11 additions
and
10 deletions
+11
-10
src/files.c
View file @
cb3fc889
...
...
@@ -3040,7 +3040,6 @@ void save_history(void)
void
save_poshistory
(
void
)
{
char
*
poshist
=
poshistfilename
();
char
*
statusstr
=
NULL
;
poshiststruct
*
posptr
;
FILE
*
hist
;
...
...
@@ -3056,23 +3055,25 @@ void save_poshistory(void)
chmod
(
poshist
,
S_IRUSR
|
S_IWUSR
);
for
(
posptr
=
position_history
;
posptr
!=
NULL
;
posptr
=
posptr
->
next
)
{
char
*
path_and_location
;
size_t
length
;
/* Assume 20 decimal positions each for line and column number,
* plus two spaces, plus the line feed, plus the null byte. */
statusstr
=
charalloc
(
strlen
(
posptr
->
filename
)
+
44
);
sprintf
(
statusstr
,
"%s %ld %ld
\n
"
,
posptr
->
filename
,
(
long
)
posptr
->
lineno
,
(
long
)
posptr
->
xno
);
length
=
strlen
(
statusstr
);
path_and_location
=
charalloc
(
strlen
(
posptr
->
filename
)
+
44
);
sprintf
(
path_and_location
,
"%s %ld %ld
\n
"
,
posptr
->
filename
,
(
long
)
posptr
->
lineno
,
(
long
)
posptr
->
xno
);
length
=
strlen
(
path_and_location
);
/* Encode newlines in filenames as nulls. */
sunder
(
statusstr
);
sunder
(
path_and_location
);
/* Restore the terminating newline. */
statusstr
[
length
-
1
]
=
'\n'
;
path_and_location
[
length
-
1
]
=
'\n'
;
if
(
fwrite
(
statusstr
,
sizeof
(
char
),
length
,
hist
)
<
length
)
fprintf
(
stderr
,
_
(
"Error writing %s: %s
\n
"
),
poshist
,
strerror
(
errno
));
free
(
statusstr
);
if
(
fwrite
(
path_and_location
,
sizeof
(
char
),
length
,
hist
)
<
length
)
fprintf
(
stderr
,
_
(
"Error writing %s: %s
\n
"
),
poshist
,
strerror
(
errno
));
free
(
path_and_location
);
}
fclose
(
hist
);
}
...
...
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