This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Remove unnecessary locking when reading iconv configuration [BZ #22062]
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Wed, 17 Oct 2018 09:19:55 -0300
- Subject: Re: [PATCH v2] Remove unnecessary locking when reading iconv configuration [BZ #22062]
- References: <20181016142341.GA37762@aloka.lostca.se>
On 16/10/2018 11:23, Arjun Shankar wrote:
> - }
> + /* No user-defined path. Make a modifiable copy of the
> + default path. */
> + gconv_path = strdupa (default_gconv_path);
> + gconv_path_len = sizeof (default_gconv_path);
> + cwd = NULL;
> + cwdlen = 0;
> + }
> + else
> + {
> + /* Append the default path to the user-defined path. */
> + size_t user_len = strlen (__gconv_path_envvar);
> +
> + gconv_path_len = user_len + 1 + sizeof (default_gconv_path);
> + gconv_path = alloca (gconv_path_len);
> + __mempcpy (__mempcpy (__mempcpy (gconv_path, __gconv_path_envvar,
> + user_len),
> + ":", 1),
> + default_gconv_path, sizeof (default_gconv_path));
> + cwd = __getcwd (NULL, 0);
> + cwdlen = __glibc_unlikely (cwd == NULL) ? 0 : strlen (cwd);
It this alloca really necessary? Can't we get rid of on along with fix (same
for other cases including strdupa)?