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
2122a1a2
Commit
2122a1a2
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: constify the result strings of getenv(), as a reminder
Also, remove an unneeded pair of braces.
parent
e2d3bba8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/history.c
+3
-3
src/history.c
src/nano.c
+1
-1
src/nano.c
src/rcfile.c
+4
-3
src/rcfile.c
src/text.c
+1
-1
src/text.c
with
9 additions
and
8 deletions
+9
-8
src/history.c
View file @
2122a1a2
...
...
@@ -250,7 +250,7 @@ void history_error(const char *msg, ...)
bool
have_statedir
(
void
)
{
struct
stat
dirstat
;
char
*
xdgdatadir
;
const
char
*
xdgdatadir
;
get_homedir
();
...
...
@@ -269,9 +269,9 @@ bool have_statedir(void)
if
(
homedir
==
NULL
&&
xdgdatadir
==
NULL
)
return
FALSE
;
if
(
xdgdatadir
!=
NULL
)
{
if
(
xdgdatadir
!=
NULL
)
statedir
=
concatenate
(
xdgdatadir
,
"/nano/"
);
}
else
else
statedir
=
concatenate
(
homedir
,
XDG_DATA_FALLBACK
"/nano/"
);
if
(
stat
(
statedir
,
&
dirstat
)
==
-
1
)
{
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
2122a1a2
...
...
@@ -2422,7 +2422,7 @@ int main(int argc, char **argv)
* checking is disabled, since it would allow reading from or
* writing to files not specified on the command line). */
if
(
!
ISSET
(
RESTRICTED
)
&&
alt_speller
==
NULL
)
{
char
*
spellenv
=
getenv
(
"SPELL"
);
const
char
*
spellenv
=
getenv
(
"SPELL"
);
if
(
spellenv
!=
NULL
)
alt_speller
=
mallocstrcpy
(
NULL
,
spellenv
);
}
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
2122a1a2
...
...
@@ -1215,7 +1215,7 @@ void parse_one_nanorc(void)
rcfile_error
(
N_
(
"Error reading %s: %s"
),
nanorc
,
strerror
(
errno
));
}
bool
have_nanorc
(
char
*
path
,
char
*
name
)
bool
have_nanorc
(
const
char
*
path
,
char
*
name
)
{
if
(
path
==
NULL
)
return
FALSE
;
...
...
@@ -1229,6 +1229,8 @@ bool have_nanorc(char *path, char *name)
/* First read the system-wide rcfile, then the user's rcfile. */
void
do_rcfiles
(
void
)
{
const
char
*
xdgconfdir
;
nanorc
=
mallocstrcpy
(
nanorc
,
SYSCONFDIR
"/nanorc"
);
/* Process the system-wide nanorc. */
...
...
@@ -1242,8 +1244,7 @@ void do_rcfiles(void)
#endif
get_homedir
();
char
*
xdgconfdir
=
getenv
(
"XDG_CONFIG_HOME"
);
xdgconfdir
=
getenv
(
"XDG_CONFIG_HOME"
);
/* Now try the to find a nanorc file in the user's home directory
* or in the XDG configuration directories. */
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
2122a1a2
...
...
@@ -1108,7 +1108,7 @@ bool execute_command(const char *command)
{
int
fd
[
2
];
FILE
*
f
;
char
*
shellenv
;
const
char
*
shellenv
;
struct
sigaction
oldaction
,
newaction
;
/* Original and temporary handlers for SIGINT. */
bool
sig_failed
=
FALSE
;
...
...
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