On Fri, Jun 12, 2015 at 03:40:23PM +0200, Sébastien Marie wrote:
> I would like to remove new_categories variable from global.
>
> This variable is used as temporary buffer in order to do checking
> before copying the content to current_categories variable.
>
> This first patch just remove the use of new_categories in load_locale_sub()
> function.
>
> load_locale_sub() is called only at one place in loadlocale():
> if (!load_locale_sub(category, new_categories[category])) {
>
> The second argument (locname) of load_locale_sub() is always defined
> with new_categories[category].
>
> So we could replace new_categories[category] by locname in function body.
>
> --
> Sébastien Marie
ok
>
>
> Index: locale/setlocale.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/locale/setlocale.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 setlocale.c
> --- locale/setlocale.c 9 Jun 2015 20:04:04 -0000 1.21
> +++ locale/setlocale.c 12 Jun 2015 13:32:08 -0000
> @@ -241,8 +241,7 @@ static int
> load_locale_sub(int category, const char *locname)
> {
> /* check for the default locales */
> - if (!strcmp(new_categories[category], "C") ||
> - !strcmp(new_categories[category], "POSIX")) {
> + if (!strcmp(locname, "C") || !strcmp(locname, "POSIX")) {
> revert_to_default(category);
> return 0;
> }