diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2017-06-16 18:10:27 -0400 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2017-06-19 00:14:00 -0400 |
commit | 1c8e01c96054973c50ec1dec2f220af4734e1de5 (patch) | |
tree | 03def41a32228b291c25526b8286c154353bcd1e /gdb/mi | |
parent | 65ce7763dfbca7f74c951767050ad2da0739869b (diff) | |
download | gdb-1c8e01c96054973c50ec1dec2f220af4734e1de5.zip gdb-1c8e01c96054973c50ec1dec2f220af4734e1de5.tar.gz gdb-1c8e01c96054973c50ec1dec2f220af4734e1de5.tar.bz2 |
Use getenv instead of gdb_environ on mi-cmd-env.c
This is a spinoff of
<https://sourceware.org/ml/gdb-patches/2017-06/msg00437.html>.
mi-cmd-env.c is using the whole gdb_environ machinery in order to
access just one variable, which can be easily replaced by a simple
call to getenv. This patch does that, and doesn't cause regressions.
gdb/ChangeLog:
2017-06-18 Sergio Durigan Junior <sergiodj@redhat.com>
* mi/mi-cm-env.c (_initialize_mi_cmd_env): Use getenv instead of
gdb_environ to access an environment variable.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-env.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c index 4093178..97be139 100644 --- a/gdb/mi/mi-cmd-env.c +++ b/gdb/mi/mi-cmd-env.c @@ -270,21 +270,17 @@ mi_cmd_inferior_tty_show (const char *command, char **argv, int argc) void _initialize_mi_cmd_env (void) { - struct gdb_environ *environment; const char *env; /* We want original execution path to reset to, if desired later. At this point, current inferior is not created, so cannot use - current_inferior ()->environment. Also, there's no obvious - place where this code can be moved such that it surely run - before any code possibly mangles original PATH. */ - environment = make_environ (); - init_environ (environment); - env = get_in_environ (environment, path_var_name); + current_inferior ()->environment. We use getenv here because it + is not necessary to create a whole new gdb_environ just for one + variable. */ + env = getenv (path_var_name); /* Can be null if path is not set. */ if (!env) env = ""; orig_path = xstrdup (env); - free_environ (environment); } |