This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] usage of environment variable from the command line
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Denis PILAT <denis dot pilat at st dot com>
- Cc: drow at false dot org, gdb-patches at sourceware dot org
- Date: Sat, 22 Dec 2007 20:05:25 +0200
- Subject: Re: [RFC] usage of environment variable from the command line
- References: <46F13F2A.8010507@st.com> <20070921225527.GA28500@caradoc.them.org> <u6423186h.fsf@gnu.org> <20070922135839.GA6285@caradoc.them.org> <m3odfst3n9.fsf@codesourcery.com> <20070930012955.GA29254@caradoc.them.org> <uir5sbp1y.fsf@gnu.org> <476BCE30.50803@st.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Fri, 21 Dec 2007 15:31:12 +0100
> From: Denis PILAT <denis.pilat@st.com>
> Cc: gdb-patches@sourceware.org
>
> The old discussion was here:
> http://sources.redhat.com/ml/gdb-patches/2007-09/msg00430.html
> My point is:
> - What do you mean by a specification ?
That question was directed at Daniel, not you.
> - You also told about quoting issues, could you please be more precise ?
That was Daniel, so he should respond. I guess he meant literal "${"
strings, which could legitimately be part of input.
> +#define ENV_DELIMITOR_BEGIN "${"
> +#define ENV_DELIMITOR_END "}"
Please use DELIMITER, not DELIMITOR.
> + int env_var_len, delimitor_begin_len, delimitor_end_len;
^^^^^^^^^ ^^^^^^^^^
Same here.
> + delimitor_begin_len = strlen(ENV_DELIMITOR_BEGIN);
> + delimitor_end_len = strlen(ENV_DELIMITOR_END);
Coding style: a space between function's name and the left
parenthesis.
> + /* replace this value into the original string. */
> + output = xmalloc (strlen (input) + strlen (env_var_value) - env_var_len - delimitor_begin_len - delimitor_end_len + 1);
This line is too long, please break into two.
> + p = evaluate_environment_from_string (p);
Are we perhaps leaking memory pointed to by `p' before the above line
executes?