diff --git a/src/history.c b/src/history.c index 7929d49b572b296c5f1f86920f45e53160859d4b..76eaead331f57264c7f247b5e0e8f6710043a66f 100644 --- a/src/history.c +++ b/src/history.c @@ -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) { diff --git a/src/nano.c b/src/nano.c index e9f73e8fc7037005343bc3efe87f50cb08b11108..45e90914a8b61e9bdde5a838d0ccbc496eab8661 100644 --- a/src/nano.c +++ b/src/nano.c @@ -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); } diff --git a/src/rcfile.c b/src/rcfile.c index 877936a473a9c8073f70d94630194aa62e9b7cf9..cdd94818b3a7959eaae3b59c6ea420b0f2ddb56d 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -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. */ diff --git a/src/text.c b/src/text.c index 7a842965737a902b7ebef3fb32ce1abd61a38347..aa1e091ac678f02a587d7487efad3ef794633aa3 100644 --- a/src/text.c +++ b/src/text.c @@ -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;