This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch#2 4/6] set auto-load safe-path


On Thu, Mar 29, 2012 at 2:14 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
[...]
> +/* Update auto_load_safe_path_vec from current AUTO_LOAD_SAFE_PATH. ?*/
> +
> +static void
> +auto_load_safe_path_vec_update (void)
> +{
> + ?char *safe_path, *filename_real = NULL, *dir;
> + ?int ix;
> +
> + ?for (ix = 0; VEC_iterate (char_ptr, auto_load_safe_path_vec, ix, dir); ++ix)
> + ? ?xfree (dir);
> + ?VEC_free (char_ptr, auto_load_safe_path_vec);
> + ?auto_load_safe_path_vec = NULL;
> +
> + ?safe_path = alloca (strlen (auto_load_safe_path) + 1);
> + ?strcpy (safe_path, auto_load_safe_path);
> +
> + ?do
> + ? ?{
> + ? ? ?char *next_dir, *real_path;
> +
> + ? ? ?next_dir = strchr (safe_path, DIRNAME_SEPARATOR);
> + ? ? ?if (next_dir != NULL)
> + ? ? ? *next_dir++ = 0;
> +
> + ? ? ?real_path = gdb_realpath (tilde_expand (safe_path));
> + ? ? ?VEC_safe_push (char_ptr, auto_load_safe_path_vec, real_path);
> +
> + ? ? ?safe_path = next_dir;
> + ? ?}
> + ?while (safe_path != NULL);
> +}

Hi.
We need a general utility routine (in a general utility kinda place)
that takes a path list and returns a vec.
There's a lot of code that could use it.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]