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
bc8a3a50
Commit
bc8a3a50
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename three variables, for visibility
(I don't /see/ single-letter variables -- they are too small.)
parent
9b90ec87
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/files.c
+17
-17
src/files.c
src/proto.h
+1
-1
src/proto.h
with
18 additions
and
18 deletions
+18
-18
src/files.c
View file @
bc8a3a50
...
...
@@ -2978,20 +2978,20 @@ void load_history(void)
}
}
/* Write the lines of a history list, starting with the line at h, to
/* Write the lines of a history list, starting with the line at h
ead
, to
* the open file at hist. Return TRUE if the write succeeded, and FALSE
* otherwise. */
bool
writehist
(
FILE
*
hist
,
filestruct
*
h
)
bool
writehist
(
FILE
*
hist
,
const
filestruct
*
h
ead
)
{
filestruct
*
p
;
const
filestruct
*
item
;
/* Write a history list from the oldest entry to the newest. Assume
* the last history entry is a blank line. */
for
(
p
=
h
;
p
!=
NULL
;
p
=
p
->
next
)
{
size_t
p_len
=
strlen
(
p
->
data
);
/* Write a history list from the oldest entry to the newest. */
for
(
item
=
head
;
item
!=
NULL
;
item
=
item
->
next
)
{
size_t
length
=
strlen
(
item
->
data
);
if
(
fwrite
(
p
->
data
,
sizeof
(
char
),
p_len
,
hist
)
<
p_len
||
putc
(
'\n'
,
hist
)
==
EOF
)
if
(
fwrite
(
item
->
data
,
sizeof
(
char
),
length
,
hist
)
<
length
)
return
FALSE
;
if
(
putc
(
'\n'
,
hist
)
==
EOF
)
return
FALSE
;
}
...
...
@@ -3051,25 +3051,25 @@ void save_poshistory(void)
chmod
(
poshist
,
S_IRUSR
|
S_IWUSR
);
for
(
posptr
=
position_history
;
posptr
!=
NULL
;
posptr
=
posptr
->
next
)
{
char
*
path_and_
location
;
char
*
path_and_
place
;
size_t
length
;
/* Assume 20 decimal positions each for line and column number,
* plus two spaces, plus the line feed, plus the null byte. */
path_and_
location
=
charalloc
(
strlen
(
posptr
->
filename
)
+
44
);
sprintf
(
path_and_
location
,
"%s %ld %ld
\n
"
,
posptr
->
filename
,
path_and_
place
=
charalloc
(
strlen
(
posptr
->
filename
)
+
44
);
sprintf
(
path_and_
place
,
"%s %ld %ld
\n
"
,
posptr
->
filename
,
(
long
)
posptr
->
lineno
,
(
long
)
posptr
->
xno
);
length
=
strlen
(
path_and_
location
);
length
=
strlen
(
path_and_
place
);
/* Encode newlines in filenames as nulls. */
sunder
(
path_and_
location
);
sunder
(
path_and_
place
);
/* Restore the terminating newline. */
path_and_
location
[
length
-
1
]
=
'\n'
;
path_and_
place
[
length
-
1
]
=
'\n'
;
if
(
fwrite
(
path_and_
location
,
sizeof
(
char
),
length
,
hist
)
<
length
)
if
(
fwrite
(
path_and_
place
,
sizeof
(
char
),
length
,
hist
)
<
length
)
fprintf
(
stderr
,
_
(
"Error writing %s: %s
\n
"
),
poshist
,
strerror
(
errno
));
free
(
path_and_
location
);
free
(
path_and_
place
);
}
fclose
(
hist
);
}
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
bc8a3a50
...
...
@@ -346,7 +346,7 @@ const char *tail(const char *path);
#ifndef DISABLE_HISTORIES
char
*
histfilename
(
void
);
void
load_history
(
void
);
bool
writehist
(
FILE
*
hist
,
filestruct
*
histhead
);
bool
writehist
(
FILE
*
hist
,
const
filestruct
*
histhead
);
void
save_history
(
void
);
int
check_dotnano
(
void
);
void
load_poshistory
(
void
);
...
...
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