From: Paul Eggert Date: Wed, 13 Feb 2013 02:10:36 +0000 (-0800) Subject: Minor getenv-related fixes. X-Git-Tag: emacs-24.3.90~173^2~7^2~66 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=83be8524033be471a4e91e9753809f36fd6fe718;p=emacs.git Minor getenv-related fixes. * callproc.c (Fcall_process_region) [!DOS_NT]: Avoid unnecessary duplicate call to getenv. * callproc.c (init_callproc): * dispnew.c (init_display): * sysdep.c (sys_subshell): Omit unnecessary cast of getenv or egetenv. --- diff --git a/src/ChangeLog b/src/ChangeLog index 7c28407d398..ed750032dd6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2013-02-13 Paul Eggert + + Minor getenv-related fixes. + * callproc.c (Fcall_process_region) [!DOS_NT]: + Avoid unnecessary duplicate call to getenv. + * callproc.c (init_callproc): + * dispnew.c (init_display): + * sysdep.c (sys_subshell): + Omit unnecessary cast of getenv or egetenv. + 2013-02-13 Juanma Barranquero * makefile.w32-in ($(BLD)/filelock.$(O), $(BLD)/sysdep.$(O)): diff --git a/src/callproc.c b/src/callproc.c index cb11ee0cc53..9132c0dd976 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -997,13 +997,11 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r tmpdir = Vtemporary_file_directory; else { + char *outf; #ifndef DOS_NT - if (getenv ("TMPDIR")) - tmpdir = build_string (getenv ("TMPDIR")); - else - tmpdir = build_string ("/tmp/"); + outf = getenv ("TMPDIR"); + tmpdir = build_string (outf ? outf : "/tmp/"); #else /* DOS_NT */ - char *outf; if ((outf = egetenv ("TMPDIR")) || (outf = egetenv ("TMP")) || (outf = egetenv ("TEMP"))) @@ -1655,7 +1653,7 @@ init_callproc (void) if (! file_accessible_directory_p (SSDATA (tempdir))) dir_warning ("arch-independent data dir", Vdata_directory); - sh = (char *) getenv ("SHELL"); + sh = getenv ("SHELL"); Vshell_file_name = build_string (sh ? sh : "/bin/sh"); #ifdef DOS_NT diff --git a/src/dispnew.c b/src/dispnew.c index 5e480d4c6f4..f9fed7de406 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6014,7 +6014,6 @@ init_display (void) inverse_video = 0; cursor_in_echo_area = 0; - terminal_type = (char *) 0; /* Now is the time to initialize this; it's used by init_sys_modes during startup. */ @@ -6109,8 +6108,7 @@ init_display (void) #ifdef WINDOWSNT terminal_type = "w32console"; #else - /* Look at the TERM variable. */ - terminal_type = (char *) getenv ("TERM"); + terminal_type = getenv ("TERM"); #endif if (!terminal_type) { diff --git a/src/sysdep.c b/src/sysdep.c index 57ca8265a65..606a5b038ca 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -527,10 +527,10 @@ sys_subshell (void) #ifdef DOS_NT /* MW, Aug 1993 */ getcwd (oldwd, sizeof oldwd); if (sh == 0) - sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ + sh = egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ #endif if (sh == 0) - sh = (char *) egetenv ("SHELL"); + sh = egetenv ("SHELL"); if (sh == 0) sh = "sh";