[PATCH v2] Remove unnecessary locking when reading iconv configuration [BZ #22062]
Adhemerval Zanella
adhemerval.zanella@linaro.org
Wed Oct 17 13:16:00 GMT 2018
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)?
More information about the Libc-alpha
mailing list