diff options
| author | Paul Eggert | 2013-02-12 18:10:36 -0800 |
|---|---|---|
| committer | Paul Eggert | 2013-02-12 18:10:36 -0800 |
| commit | 83be8524033be471a4e91e9753809f36fd6fe718 (patch) | |
| tree | 7620ff5770eb382ff9a17cf03094b1ff3a35156a /src | |
| parent | d6596b941f935f02c312bf6200ad9469819859c9 (diff) | |
| download | emacs-83be8524033be471a4e91e9753809f36fd6fe718.tar.gz emacs-83be8524033be471a4e91e9753809f36fd6fe718.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/callproc.c | 10 | ||||
| -rw-r--r-- | src/dispnew.c | 4 | ||||
| -rw-r--r-- | src/sysdep.c | 4 |
4 files changed, 17 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7c28407d398..ed750032dd6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-02-13 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Minor getenv-related fixes. | ||
| 4 | * callproc.c (Fcall_process_region) [!DOS_NT]: | ||
| 5 | Avoid unnecessary duplicate call to getenv. | ||
| 6 | * callproc.c (init_callproc): | ||
| 7 | * dispnew.c (init_display): | ||
| 8 | * sysdep.c (sys_subshell): | ||
| 9 | Omit unnecessary cast of getenv or egetenv. | ||
| 10 | |||
| 1 | 2013-02-13 Juanma Barranquero <lekktu@gmail.com> | 11 | 2013-02-13 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 12 | ||
| 3 | * makefile.w32-in ($(BLD)/filelock.$(O), $(BLD)/sysdep.$(O)): | 13 | * 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 | |||
| 997 | tmpdir = Vtemporary_file_directory; | 997 | tmpdir = Vtemporary_file_directory; |
| 998 | else | 998 | else |
| 999 | { | 999 | { |
| 1000 | char *outf; | ||
| 1000 | #ifndef DOS_NT | 1001 | #ifndef DOS_NT |
| 1001 | if (getenv ("TMPDIR")) | 1002 | outf = getenv ("TMPDIR"); |
| 1002 | tmpdir = build_string (getenv ("TMPDIR")); | 1003 | tmpdir = build_string (outf ? outf : "/tmp/"); |
| 1003 | else | ||
| 1004 | tmpdir = build_string ("/tmp/"); | ||
| 1005 | #else /* DOS_NT */ | 1004 | #else /* DOS_NT */ |
| 1006 | char *outf; | ||
| 1007 | if ((outf = egetenv ("TMPDIR")) | 1005 | if ((outf = egetenv ("TMPDIR")) |
| 1008 | || (outf = egetenv ("TMP")) | 1006 | || (outf = egetenv ("TMP")) |
| 1009 | || (outf = egetenv ("TEMP"))) | 1007 | || (outf = egetenv ("TEMP"))) |
| @@ -1655,7 +1653,7 @@ init_callproc (void) | |||
| 1655 | if (! file_accessible_directory_p (SSDATA (tempdir))) | 1653 | if (! file_accessible_directory_p (SSDATA (tempdir))) |
| 1656 | dir_warning ("arch-independent data dir", Vdata_directory); | 1654 | dir_warning ("arch-independent data dir", Vdata_directory); |
| 1657 | 1655 | ||
| 1658 | sh = (char *) getenv ("SHELL"); | 1656 | sh = getenv ("SHELL"); |
| 1659 | Vshell_file_name = build_string (sh ? sh : "/bin/sh"); | 1657 | Vshell_file_name = build_string (sh ? sh : "/bin/sh"); |
| 1660 | 1658 | ||
| 1661 | #ifdef DOS_NT | 1659 | #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) | |||
| 6014 | 6014 | ||
| 6015 | inverse_video = 0; | 6015 | inverse_video = 0; |
| 6016 | cursor_in_echo_area = 0; | 6016 | cursor_in_echo_area = 0; |
| 6017 | terminal_type = (char *) 0; | ||
| 6018 | 6017 | ||
| 6019 | /* Now is the time to initialize this; it's used by init_sys_modes | 6018 | /* Now is the time to initialize this; it's used by init_sys_modes |
| 6020 | during startup. */ | 6019 | during startup. */ |
| @@ -6109,8 +6108,7 @@ init_display (void) | |||
| 6109 | #ifdef WINDOWSNT | 6108 | #ifdef WINDOWSNT |
| 6110 | terminal_type = "w32console"; | 6109 | terminal_type = "w32console"; |
| 6111 | #else | 6110 | #else |
| 6112 | /* Look at the TERM variable. */ | 6111 | terminal_type = getenv ("TERM"); |
| 6113 | terminal_type = (char *) getenv ("TERM"); | ||
| 6114 | #endif | 6112 | #endif |
| 6115 | if (!terminal_type) | 6113 | if (!terminal_type) |
| 6116 | { | 6114 | { |
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) | |||
| 527 | #ifdef DOS_NT /* MW, Aug 1993 */ | 527 | #ifdef DOS_NT /* MW, Aug 1993 */ |
| 528 | getcwd (oldwd, sizeof oldwd); | 528 | getcwd (oldwd, sizeof oldwd); |
| 529 | if (sh == 0) | 529 | if (sh == 0) |
| 530 | sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ | 530 | sh = egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ |
| 531 | #endif | 531 | #endif |
| 532 | if (sh == 0) | 532 | if (sh == 0) |
| 533 | sh = (char *) egetenv ("SHELL"); | 533 | sh = egetenv ("SHELL"); |
| 534 | if (sh == 0) | 534 | if (sh == 0) |
| 535 | sh = "sh"; | 535 | sh = "sh"; |
| 536 | 536 | ||